Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lucene select all query

Tags:

syntax

lucene

Im using 3.6.2 lucene and I try to write query which will select all docs. Here's some of my code:

searchString = "content:*";
query = parser.parse(QueryParser.escape(searchString));
indexSearcher.search(query, null, collector);

But this request returns only about 25% of docs, I cant get why and how to make such query.

UPDATE

*:* also didn't select all docs, but replacing query with new MatchAllDocsQuery() helped, thanks.

like image 228
flgdev Avatar asked Jan 20 '15 13:01

flgdev


People also ask

How do you query in Lucene?

Lucene supports single and multiple character wildcard searches within single terms (not within phrase queries). To perform a single character wildcard search use the "?" symbol. To perform a multiple character wildcard search use the "*" symbol. You can also use the wildcard searches in the middle of a term.

How do I use Lucene query in Kibana?

To use the Lucene syntax, open the Saved query menu, and then select Language: KQL > Lucene. To search for a range of values, use the bracketed range syntax, [START_VALUE TO END_VALUE] . For example, to find entries that have 4xx status codes, you could enter status:[400 TO 499] .

What is a Lucene filter?

Lucene is a query language that can be used to filter messages in your PhishER inbox. A query written in Lucene can be broken down into three parts: Field The ID or name of a specific container of information in a database. If a field is referenced in a query string, a colon ( : ) must follow the field name.


1 Answers

Use MatchAllDocsQuery. It's string representation is *:*.

like image 132
mindas Avatar answered Oct 07 '22 11:10

mindas