Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I search on a list of values using Solr/Lucene?

Tags:

solr

lucene

Given the following query:

(field:value1 OR field:value2 OR field:value3 OR ... OR field:value50) 

Can this be broken down into something less verbose? Basically I have hundreds of category IDs, and I need to search for items under large groups of category IDs (20-50 at a time). In MySQL, I'd just use field IN(value1, value2, value3) rather than (field = value1 OR field = value2 etc...).

Is there a simpler way for Solr/Lucene?

like image 809
Michael Moussa Avatar asked Apr 10 '10 13:04

Michael Moussa


People also ask

How do I query a collection in Solr?

You can search for "solr" by loading the Admin UI Query tab, enter "solr" in the q param (replacing *:* , which matches all documents), and "Execute Query". See the Searching section below for more information. To index your own data, re-run the directory indexing command pointed to your own directory of documents.

How can I search in Solr?

You perform a search by typing search queries into the appropriate filter in the Filter panel. This topic provides a brief introduction to the types of Solr search syntax that you can use to examine your data.

What is Solr full-text search?

Solr is a mighty tool to perform full text search with many of extra features, such as (various kinds of) facets, "Did you mean?" functionality and highlighting with suitable selection of text snippets for an extract.


1 Answers

Use

field:(value1 value2 value3) 

or if your default operator is AND then use

field:(value1 OR value2 OR value3) 
like image 90
martsraits Avatar answered Oct 01 '22 17:10

martsraits