unexpected solr result set when searching for a keyword - search

i am trying to do simple search query in solr however one of the result set is actually strange,
when searching for
poi_name:hamad
i am getting good results but among them
"early education center h b k u" with a score:1.8473094
Any idea why this has a score in the first place?
poi_name field is of Textfiled type

I found a synonym entry of h => hamad that explains why i am getting this result

Related

Solr inaccurate search result

it seems to be an issue / bad configuration in my solr index.
In detail when I perform a search by using some words in my query the solr result is ok, it returns me 50 entries.
Let me show an example :
Example 1)
url = http://mydomain:8983/solr/mycore/select?q=walk%20in%20the%20city
query = walk in the city
results = 231373, 231372, 231454, ....
Unfortunately when I use a single word in my query the solr result is "truncated"
Let me show some examples :
Example 2)
url = http://mydomain:8983/solr/mycore/select?q=Walk
query = Walk
results = 231373, 231372
Example 3)
url = http://mydomain:8983/solr/mycore/select?q=city
query = city
results = 231373, 231372
As you can see "Walk" and "city" words are inside my first query set.
The results in examples 2/3 are the same.
I'm a beginner in using solr, probably I perform some mistakes in solr configuration.
What I have to check first in order to optimize the query?
Thanks in advance.
Best regards.
Sergio
I would suggest to add debugQuery=true to your query and look at the debug node in the result. Under debug in particular look at the parsedquery to see what Solr is doing with your query, like what fields it's searching and whether it is using AND or OR between expressions (e.g. +fieldName means AND).
Also, under the debug there is an explain node that contains the documents that were found and why they were found. That should help you pin point why those records were returned. The explain output is pretty convoluted, but there is a lot of useful information there for this kind of issues.
(I realize this is not quite an answer to your question, but it's too long for a comment.)

Azure Search: Keyword tokenizer don't work with multi word search

I have a fields in index with [Analyzer(<name>)] applied. This analyzer is of type CustomAnalyzer with tokenizer = Keyword. I assume it treats both field value and search text as one term each. E.g.
ClientName = My Test Client (in index, is broken into 1 term). Search term = My Test Client (broken in 1 term). Result = match.
But surprisingly that's not the case until I apply phrasal search (enclose term in double quotes). Does anyone know why? And how to solve it? I'd rather treat search term as the whole, then do enclosing
Regards,
Sergei.
This is expected behavior. Query text is processed first by the query parser and only individual query terms go through lexical analysis. When you issue a phrase query, the whole expression between quotes is treated as a phrase term and as one goes through lexical analysis. You can find a complete explanation of this process here: How full text search works in Azure Search.

Elastic search : Searching for integers with wildcards

I am currently using the tire client for elastic search. Lets say I have a field which is indexed as a field of type long in my elastic search mapping.
I am trying to achieve something like this:
search.query {|query| query.string "30*", :fields => ['id']}
Here 'id' is the long field about which I was talking about. But since I specify the fields in the query, the wildcard doesn't work and I end up getting the exact match as the only result.
But doing the same thing works with the _all search as the field type doesn't matter. I want this wildcard search to work while also searching for the search key in that particular field. Is there any way to do this without changing my mapping?
I see next solutions:
use multifield and make this also of a string type (but requires mapping change)
use range and translate this into something like:
(from 30 to 39) or (from 300 to 309) or (from 3000 to 3099)
or (from 30000 to 30999) or ... (to max value)
use http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html and check this using scripting
Thanks to #alex on that scripting tip. Finally I found something which worked. Phew!
So I ended up doing this(briefly):
search.query do |query|
query.filtered do |f|
f.filter :script, {
:script => "doc['id'].value.toString() ~= '^30[0-9]*$'"
}
end
end
Hope it helps.

Lucene syntax: what is the difference between AND and +

I am newest in Lucene.
I'm using Lucene.NET version 2.9.4.
What is the difference between these queries?
the first is:
title:hello AND tags:word
the second is:
+title:hello +tags:word
I testing a software, and I note that the first returns 3 records, and the second returns many records.
I observe that the first returns records where title and tags fields are fuel, but the second returns records where title and tags can be empty.
Is it the difference?
There is no difference between the two. clause1 AND clause2 is effectively shorthand for +clause1 +clause2
Similarly: clause1 clause2 = clause1 OR clause2
Note, there is really no equivalent for +clause1 clause2 using the boolean operators.
Are you sending the query over the Internet, if you are and not urlencoding the request correctly it could be misinterting the '+' as an encoded space and therefore lucene just runs the second query as if the +'s not there which would just OR the two parts and give the results you get.
title:hello tags:word

Get first element of IxSet query result in Haskell

I'm trying to use IxSet for database-like purposes, so I've built an index of items and I need to do exact match on some field.
Query operator (#=) http://hackage.haskell.org/packages/archive/ixset/1.0.2/doc/html/Data-IxSet.html#v:-64--61- returns an IxSet a type, but I need only to either get 1 or 0 results. To check if it's 0 results, I do null items on that, but how do I get first item?
Due to description of IxSet type http://hackage.haskell.org/packages/archive/ixset/1.0.5/doc/html/Data-IxSet.html#t:IxSet I don't see any typeclass that has operation like head or fst.
Ok, found an answer. You should use some available function like getOne http://hackage.haskell.org/packages/archive/ixset/1.0.5/doc/html/Data-IxSet.html#v:getOne , for example.
p.s.: I find that a bit strange to first create your type from list of items and then add operations that duplicate list-operations, but maybe I'm just newbie :)

Resources