I am trying to search for two subsequent words as follow:
{!surround}FieldName:first w second
The query works great, but SOLR throws parse exception when one of the words contains quote char, i.e
{!surround}FieldName:first w sec"ond
I have tried to escape the qutoe:
{!surround}FieldName:first w sec\"ond
but it didnt help.
I tried also using the v parameter of LocalParams, but no good either.
{!surround v="first w sec\"ond"}FieldName
I am currently running Solr 4.0.
Does anybody knows how to overcome this problem?
Try this:
{!surround}FieldName:(w(first,"sec\"ond"))
Related
Hi I am challenged by this error using Wildcard(*) in a string to locate a frame !
When i write the complete name of the iFrame in the statement, it has no issues finding the Frame .
Your thoughts are appreciated!
driver.SwitchTo().Frame("*_ifr")
OpenQA.Selenium.NoSuchFrameException: 'No frame element found with name or id *_ifr'
When I enter the entire frames name like below, it works just fine
driver.SwitchTo().Frame("txt-client-instructions_ifr")
I expect the wildcard will find the following iframes
1st txt-client-instructions_ifr
2nd 107314_100323_ifr
3rd 107341_100324_ifr
4th 100321_macrotext_ifr
SwitchTo().Frame() is the method to give you access to switch frames and windows. The argument type is of String. As an example:
driver.SwitchTo().Frame("FrameName");
String doesn't support wildcards where as By.CssSelector or By.XPath supports wildcards.
Hence,
driver.SwitchTo().Frame("txt-client-instructions_ifr")
is successful, where as:
driver.SwitchTo().Frame("*_ifr")
raises OpenQA.Selenium.NoSuchFrameException.
I have Alfresco 5.2 and my task is "to get all documents with empty (one of) property", I am creating a query
searchParameters.setQuery("search +TYPE:\"ecmcndintregst:nd_int_reg_standards\" +#ecmcnddoc\\:doc_name_ru:\"\" -ASPECT:\"ecmcdict:inactive\" AND ( #ecmcnddoc\\:doc_kind_cp_ecmcdict_value:\"mek\")");
And I got all the documents thus: with either - empty and non-empty ecmcnddoc:doc_name_ru
how can I get ONLY empty ecmcnddoc:doc_name_ru ?
Thank you
please tell me what am I doing wrong? How to search solr for empty properties? When I submit +#ecmcnddoc:doc_name_ru:"" (without slash) I got all documents with ANY ecmcnddoc:doc_name_ru value :(
Thank you
I am migrating from solr 5.5 to solr 8.
Query for solr 5.5 looks like -
qt=/dismax
product_fields_Ref1=product_concept^279841
sku_and_product_fields_Ref1=silhouette_concept^234256 $product_fields_Ref1
product_phrase_Ref2=pant
concept_with_synonyms_ref1=({!edismax2 qf=$sku_and_product_fields_Ref1 v=$product_phrase_Ref2})
top_concept_query_ref= (+({!maxscore v=$concept_with_synonyms_ref1}) )
productQueryRef3=+(+({!query v=$cq})) +( ({!maxscore v=$top_concept_query_ref}) )
sq=+{!lucene v=$productQueryRef3}
q={!parent tag=top which=$pq score=max v=$sq}
But is giving error on solr 8.0 with error -
Error from server at http://localhost:8080/products: org.apache.solr.search.SyntaxError: Query Field '$product_fields_Ref1' is not a valid field name
If I modify query like this (remove the variable product_fields_Ref1 and append the value directly in sku_and_product_fields_Ref1) -
qt=/dismax
sku_and_product_fields_Ref1=silhouette_concept^234256 product_concept^279841
product_phrase_Ref2=pant
concept_with_synonyms_ref1=({!edismax2 qf=$sku_and_product_fields_Ref1 v=$product_phrase_Ref2})
top_concept_query_ref= (+({!maxscore v=$concept_with_synonyms_ref1}) )
productQueryRef3=+(+({!query v=$cq})) +( ({!maxscore v=$top_concept_query_ref}) )
sq=+{!lucene v=$productQueryRef3}
q={!parent tag=top which=$pq score=max v=$sq}
Problem is I can not modify this query since the value of param "product_fields_Ref1" are being compiled from a large number of places.
I am using defType=dismax only.
Can any one guide what needs to be fixed?
I went through the source code of "org.apache.solr.search.ExtendedDismaxQParser"
and found out the is a new validation check added which DOES NOT allow local parameter in qf field edismax parser (this check has been introduced starting solr 8.0.0).
Check works like this -
any parameter coming in qf MUST match a field in schema (I am not using schema-less mode) of the core. method is
validateQueryFields(up);
This executes in
public Query parse() throws SyntaxError { ... }
of
org.apache.solr.search.ExtendedDismaxQParser
I got this working by creating my own custom parser and removed this validator after overriding the parse() method.
Support for Local Parameters has changed significantly in more recent versions of Solr (see https://lucene.apache.org/solr/guide/7_5/solr-upgrade-notes.html#solr-7-2)
The only way that I have been able to get some of the behavior back is by setting lucene as the default parser in solrconfig.xml and then passing the local parameters in the query, for example: q={!dismax qf=$param1}coffee
I understand that you can get back the old behavior by switching to LuceneMatchVersion 7.1.0 but that change did not work for me.
I wrote some text search with use Google App Engine search.
In SDK I tested such query on atom field:
u'tag:"wartości"'
In production I run the same query but it not works on same data.
How can I do unicode query on atom field?
Is it possible to use unicode in Google App Engine search?
We are aware of this issue and plan to fix ASAP. The fix that we're currently planning will require that the atom field value include exactly the same accent characters in order to match. Matches will continue to be case-insensitive. We expect that at least initially, values that use combining diacritical marks will be treated as different values than those using precomposed characters. We may revisit that decision depending on feedback, but it's the most straightforward fix on our end.
For more on the precomposed characters vs. combining diacritical marks, see this Wikipedia article:
http://en.wikipedia.org/wiki/Precomposed_character
Chris
It looks that I need translate AtomField values into new string and I need to translate queries too. This workaround will allow only Polish unicode search. I do not know tonkenization rules so I use 'q', 'x' to expand alphabet since not used in Polish.
# coding=utf-8
translate = {
u'ą': u'aq',
u'Ą': u'Aq',
u'ć': u'cq',
u'Ć': u'Cq',
u'ę': u'eq',
u'Ę': u'Eq',
u'ł': u'lq',
u'Ł': u'Lq',
u'ń': u'nq',
u'Ń': u'Nq',
u'ó': u'oq',
u'Ó': u'Oq',
u'ś': u'sq',
u'Ś': u'Sq',
u'ż': u'zx',
u'Ż': u'Zx',
u'ź': u'zq',
u'Ź': u'Zq',
}
import re
reTranslate = re.compile(u'(%s)' % u'|'.join(translate))
print reTranslate.pattern
test = u"""\
Właściwie prowadzona komunikacja wewnętrzna w firmie,\
zwłaszcza dużej czy posiadającej rozproszoną sieć oddziałów,\
może przynieść oszczędność czasu, a co za tym idzie, również pieniędzy."""
print reTranslate.sub(lambda match: translate[match.group(0)], test)
I am trying to integrate solr with java using solrj. The result retrieved are of the format
{
numFound=3,
start=0,
docs=[
SolrDocument{
id=IW-02,
name=iPod&iPodMiniUSB2.0Cable,
manu=Belkin,
manu_id_s=belkin,
cat=[
electronics,
connector
],
features=[
carpoweradapterforiPod,
white
],
weight=2.0,
price=11.5,
price_c=11.50,
USD,
popularity=1,
inStock=false,
store=37.7752,
-122.4232,
manufacturedate_dt=TueFeb1418: 55: 59EST2006,
_version_=1452625905160552448
}
Now this is the javabin format. How do I extract results from this? Have heard that solrj does convert the results to objects by itself. But cant figure out how.
Thanks for the help in advance.
Let solrReply be the response object. The you can access different parts of the result using appropriate params. Say you want docs, you can do:
docs = solrReply['docs']
if you want the first result you could do:
first = solrReply['docs'][0]
Within a result you can access each field in the same way.