Vague Searches


(Jason-4) #1

I'm trying to figure out the best approach to handling a "vague"
search. Say I have a document with a string attribute '123 Main St,
Boston, MA, 02118' I'd like to be able to search for it using '123
Main Boston' and 'Main St, 02118', etc. I've run into issues with
both Text and Terms searches in that there are too many matches on
'Boston' or '02118'. I have indexes on the address parts (number,
street, town, state, zip), but using Or or Should, I run into the same
problem, too many results. Is there a way to boost the number and
address as part of an Or Terms match?


(Jan Fiedler) #2

For searches on the full address field I'd recommend setting the operator
of the text query to 'and'. This should make sure all the terms the user
entered are (somehow) part of the indexed address. This approach will
provide no results if the user entered terms that are not part of the
address. In such a case you could fallback to an 'or' text search.


(Karussell) #3

Probably with a combination of this:

http://www.elasticsearch.org/guide/reference/query-dsl/custom-filters-score-query.html

and boosting while indexing you can reach your goal (?)

Peter.

On 19 Jan., 23:06, Jason jvanderh...@gmail.com wrote:

I'm trying to figure out the best approach to handling a "vague"
search. Say I have a document with a string attribute '123 Main St,
Boston, MA, 02118' I'd like to be able to search for it using '123
Main Boston' and 'Main St, 02118', etc. I've run into issues with
both Text and Terms searches in that there are too many matches on
'Boston' or '02118'. I have indexes on the address parts (number,
street, town, state, zip), but using Or or Should, I run into the same
problem, too many results. Is there a way to boost the number and
address as part of an Or Terms match?


(Shay Banon) #4

Another option is to use the more like this query.

On Sat, Jan 21, 2012 at 10:49 PM, Karussell tableyourtime@googlemail.comwrote:

Probably with a combination of this:

http://www.elasticsearch.org/guide/reference/query-dsl/custom-filters-score-query.html

and boosting while indexing you can reach your goal (?)

Peter.

On 19 Jan., 23:06, Jason jvanderh...@gmail.com wrote:

I'm trying to figure out the best approach to handling a "vague"
search. Say I have a document with a string attribute '123 Main St,
Boston, MA, 02118' I'd like to be able to search for it using '123
Main Boston' and 'Main St, 02118', etc. I've run into issues with
both Text and Terms searches in that there are too many matches on
'Boston' or '02118'. I have indexes on the address parts (number,
street, town, state, zip), but using Or or Should, I run into the same
problem, too many results. Is there a way to boost the number and
address as part of an Or Terms match?


(system) #5