Hi,
I am new to the solr community, and have this weird problem with the search
results
here is whats going on. i have a logfile that is indexed into solr with the
following config
<field name="log" type="text_general" indexed="true" termOffsets="true"
stored="true" termPositions="true" termVectors="true" multiValued="false"
required="true"/>
<fieldType name="text_general" class="solr.TextField" positionIncrementGap=
"100" multiValued="true"> <analyzer type="index"> <tokenizer class=
"solr.StandardTokenizerFactory"/> <filter class="solr.StopFilterFactory"
words="stopwords.txt" ignoreCase="true"/> <filter class=
"solr.LowerCaseFilterFactory"/> </analyzer> <analyzer type="query"> <
tokenizer class="solr.StandardTokenizerFactory"/> <filter class=
"solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/> <filter
class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms=
"synonyms.txt"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer>
</fieldType>
here is a sample for demonstration purpose, assume the following
logfile(text) is indexed to solr in the field "log"
AppleCare+ extends the basic warranty that covers non-accidental iPhone
mishaps -- such as battery issues or a faulty headphone jack -- from one
year to two. The iPhone X was unveiled to much fanfare last month. It
boasts a radical update to the iPhone models of years past, with an
all-glass display and an option to unlock with facial recognition. It also
has an all-glass back, so owners run the risk of cracking either side of
the phone. However, Apple has claimed the glass on the iPhone 8 and iPhone
X is much stronger than earlier models, so it could be harder to break.
Pre-orders for the phone began online Friday, and units were selling out
quickly. The U.S. Apple Store site said it would take
now the query that i run is as follows:
q=("warranty that covers non-accidental") OR ("risking it all" AND "harder
to break")
hl.q=("warranty that covers non-accidental") OR ("risking it all" AND "harder
to break")
hl=true hl.fl=log hl.usePhraseHighlighter=true hl.fragsize=2000
hl.maxAnalyzedChars=2097152
indent=on
or as a URL
http://localhost:8983/solr/mycore/select?hl.usePhraseHighlighter=true&hl.fl=log&hl=true&hl.fragsize=2000&indent=on&wt=json
&hl.q=(%22warranty%20that%20covers%20non-accidental%22)%20OR%20(%22risking
%20it%20all%22%20AND%20%22harder%20to%20break%22)&q=(%22warranty%20that%20
covers%20non-accidental%22)%20OR%20(%22risking%20it%20all
%22%20AND%20%22harder%20to%20break%22)
the response is as follows:
{
"responseHeader":{
"status":0,
"QTime":24,
"params":{
"q":"(\"warranty that covers non-accidental\") OR (\"risking it all\"
AND \"harder to break\")",
"hl":"true",
"indent":"on",
"hl.q":"(\"warranty that covers non-accidental\") OR (\"risking it
all\" AND \"harder to break\")",
"hl.usePhraseHighlighter":"true",
"hl.fragsize":"2000",
"hl.fl":"log",
"wt":"json"}},
"response":{"numFound":1,"start":0,"docs":[
{
"logid":5487941,
"log":"AppleCare+ extends the basic warranty that covers
non-accidental iPhone mishaps -- such as battery issues or a faulty
headphone jack -- from one year to two.\nThe iPhone X was unveiled to much
fanfare last month. It boasts a radical update to the iPhone models of
years past, with an all-glass display and an option to unlock with facial
recognition.\nIt also has an all-glass back, so owners run the risk of
cracking either side of the phone.\nHowever, Apple has claimed the glass on
the iPhone 8 and iPhone X is much stronger than earlier models, so it could
be harder to break.\nPre-orders for the phone began online Friday, and
units were selling out quickly. The U.S. Apple Store site said it would
take \n",
"_version_":1582439847966015488}]
},
"highlighting":{
"5487941":{
"log":["AppleCare+ extends the basic *<em>warranty</em> <em>that</em>
<em>covers</em> <em>non-accidental</em>* iPhone mishaps -- such as battery
issues or a faulty headphone jack -- from one year to two.\nThe iPhone X
was unveiled to much fanfare last month. It boasts a radical update to the
iPhone models of years past, with an all-glass display and an option to
unlock with facial recognition.\nIt also has an all-glass back, so owners
run the risk of cracking either side of the phone.\nHowever, Apple has
claimed the glass on the iPhone 8 and iPhone X is much stronger than
earlier models, so it could be *<em>harder</em> <em>to</em>
<em>break</em>*.\nPre-orders
for the phone began online Friday, and units were selling out quickly. The
U.S. Apple Store site said it would take \n"]
}
}
}
i get the correct document as a hit, but the highlighted text is wrong, i
am wondering the querying is straight forward, match either condition 1 or
condition 2
where condition 1 = "warranty that covers non-accidental"
and condition 2 = "risking it all" AND "harder to break"
now the hit is correct as condition 1 matched, but why is the highlight
indicating that it also matched part of the condition 2. why is it ignoring
the AND operator for condition 2
Am i missing something here. I am hoping to get this resolved as i am
planning to use even more complex queries like
*(condition 1) OR (**condition **2) OR (**condition **3) OR (**condition **4
AND condition 5) OR (**condition **6 AND condition 5 NOT condition 7)*
I am looking for some pointers
Thanks
Ankit