Query parsed to: +boolean +queri
1 - 19 of 19 results (Page 1 of 1)
3.5.2 : Boolean operators
starts on page 94 under section 3.5 (Parsing query expressions: QueryParser) in chapter 3 (Adding search to your application)
...Constructing
Boolean queries textually via QueryParser is done using the opera- tors AND, OR, and NOT. Terms listed without an operator specified use an implicit operator, which by default is OR. The
query abc xyz will be interpreted as either abc OR xyz or abc AND xyz, based on the implicit ... shortcut syntax; table 3.7 illustrates various syntax equivalents. Table 3.7
Boolean query operator ... with at least one nonnegated term to return documents; in other words, it isn't possible to use a
query like... [
Full sample chapter]
10.5 : Alias-i: orthographic variation with Lucene
starts on page 351 in chapter 10 (Case studies)
... and store each such bag of sequences as a Lucene document. Queries are similarly parsed into bags of character subse- quences from which boolean query clauses are formed. The hits resulting from a query term will be the documents representing the terms in order of their fuzzy string similarity to the query ... 2 to 4: "Al", "l ", " J", ..., "ah", ..., "Al Ja", "l Ja", " Jaz", ..., "erah" Used as a query, "Al Jazeerah ... used in a query for "Al Jazeerah" Score Result 999 Al Jazeerah 787 Al Jazeera 406 Jazeera...
3.4.4 : Combining queries: BooleanQuery
starts on page 85 under section 3.4 (Creating queries programmatically) in chapter 3 (Adding search to your application)
... to a BooleanQuery using this API method: public void add(
Query query,
boolean required,
boolean ... with a "2004" PrefixQuery.) d Here we combine the two
queries into a single
boolean query with both ... a Boolean- Clause, and the other accepts a
Query and two
boolean flags. A BooleanClause is a container of a
query ... The various
query types discussed here can be combined in complex ways using BooleanQuery. BooleanQuery itself is a container of
Boolean clauses. A clause is a subquery that can be optional, required... [
Full sample chapter]
10.1.2 : Other Nutch features
starts on page 328 under section 10.1 (Nutch: "The NPR of search engines") in chapter 10 (Case studies)
... has a different weight. The Nutch Query Handler generates a Lucene boolean query that contains ... The Query Handler asks each Index Searcher for only a small number of documents (usually 10). Since ... one source, especially when users rarely move beyond the first page of results. Each user query is actually expanded to quite a complicated Lucene query before it is processed.2 Each indexed document ... of multiword queries, which would require a limited amount of integration. 2 Authors' note: See more...
1.7.1 : IR libraries
starts on page 24 under section 1.7 (Review of alternate search products) in chapter 1 (Meet Lucene)
... and developer mailing list discussions. Egothor supports an extended
Boolean model, which allows it to function as both the pure
Boolean model and the Vector model. You can tune which model to use via a simple
query-time parameter. This software features a number of dif- ferent
query types, supports similar search syntax, and allows multithreaded
querying, which can come in handy if you're working ... of
queries and has a
query parser that supports human-friendly search syntax; stemmers based... [
Full sample chapter]
3.4.2 : Searching within a range: RangeQuery
starts on page 83 under section 3.4 (Creating queries programmatically) in chapter 3 (Adding search to your application)
... range
queries inclusive of the begin and end terms: public class RangeQueryTest extends LiaTestCase ... (); } public void testInclusive() throws Exception { RangeQuery
query = new RangeQuery(begin, end, true); IndexSearcher searcher = new IndexSearcher(directory); Hits hits = searcher.search(
query); assertEquals ... to construct a RangeQuery is a
boolean flag indicating whether the range is inclusive. Using the same ... Exception { RangeQuery
query = new RangeQuery(begin, end, false); IndexSearcher searcher = new IndexSearcher... [
Full sample chapter]
3.1 : Implementing a simple search feature
starts on page 69 in chapter 3 (Adding search to your application)
... 6, syn- onym injection in chapter 4, and the
Boolean logic in this chapter. In this chapter, we'll limit ... methods.
Query (and Concrete subclasses encapsulate logic for a particular
query type. Instances of subclasses)
Query are passed to an IndexSearcher's search method. QueryParser Processes a human-entered (and readable) expression into a concrete
Query object. Hits Provides access to search results. Hits is returned from IndexSearcher's search method. When you're
querying a Lucene index, an ordered... [
Full sample chapter]
3.3 : Understanding Lucene scoring
starts on page 78 in chapter 3 (Adding search to your application)
..., boosting it would boost all matched documents equally. In a multiple-clause
boolean query, some documents ... . Figure 3.1 Lucene uses this formula to determine a document score based on a
query. Table ... (q, d) Coordination factor, based on the number of
query terms the document contains. queryNorm(q) Normalization value for a
query, given the sum of the squared weights of each of the
query terms. Boost factors are built into the equation to let you affect a
query or field's influ- ence on score. Field boosts... [
Full sample chapter]
1.4.2 : Searching an index
starts on page 15 under section 1.4 (Lucene in action: a sample application) in chapter 1 (Meet Lucene)
..., we chose the
Boolean query 'lucene AND NOT slow', which finds all files that contain the word lucene ... arguments: The path to the index created with Indexer A
query to use to search the index Listing 1.2 Searcher: searches a Lucene index for a
query passed as an argument /** * This code was originally ... " + Searcher.class.getName() + "
<query>"); } Index directory File indexDir = new File(args[0]); created by Indexer String q = args[1]; Query string if (!indexDir.exists() || !indexDir... [Full sample chapter]
10.5.5 : A subword Lucene analyzer
starts on page 357 under section 10.5 (Alias-i: orthographic variation with Lucene) in chapter 10 (Case studies)
... that they are added to the boolean query as optional terms that are neither required nor prohibited ... . We employ the same n-gram extractor, converting the n-gram tokens into term query clauses: public static ... the IndexSearcher to build in the n-gram query parser: public static class NGramSearcher extends ... and result ordering. Here's an example of some of the queries run over 1,307 newswire docu- ments ... as a query. Total processing time was under two minutes on a modest personal computer, including the time...
3.4.5 : Searching by phrase: PhraseQuery
starts on page 87 under section 3.4 (Creating queries programmatically) in chapter 3 (Adding search to your application)
...(directory); } private
boolean matched(String[] phrase, int slop) throws IOException { PhraseQuery
query = new PhraseQuery();
query.setSlop(slop); for (int i=0; i < phrase.length; i++) {
query.add(new Term("field", phrase[i])); } Hits hits = searcher.search(
query); return hits.length() > 0; } } Because we want to demonstrate several phrase
query examples, we wrote the matched method to simplify ... a phrase
query matched the test document: public class PhraseQueryTest extends TestCase { private... [
Full sample chapter]
6.3.1 : Customizing QueryParser's behavior
starts on page 203 under section 6.3 (Extending QueryParser) in chapter 6 (Extending search)
... of query is desired, override this method. For example, a SpanNearQuery can replace PhraseQuery ... , int slop) getFuzzyQuery(String field, Fuzzy queries can adversely affect performance. Override and throw a String termStr) ParseException to disallow fuzzy queries. getPrefixQuery(String field, This method is used to construct a query when the term ends with an String termStr) asterisk. The term ... this method to perform any desired analysis. getRangeQuery(String field, Default range-query behavior has...
5.7.1 : Books like this
starts on page 186 under section 5.7 (Leveraging term vectors) in chapter 5 (Advanced search techniques)
..., we use Lucene's bool- ean query capability and the information from one book to look up other books ... before books by other authors. e Using the terms from the subject term vectors, we add each to a boolean query. f We combine the author and subject queries into a final boolean query. g We exclude ... likeThisQuery = new BooleanQuery(); f Create final likeThisQuery.add(authorQuery, false, false); query ... ( current book new Term("isbn", doc.get("isbn"))), false, true); //System.out.println(" Query...
6.5.3 : QueryParser again!
starts on page 218 under section 6.5 (Performance testing) in chapter 6 (Extending search)
... integers for range queries. The desired effect is shown in the following test: public void ... StandardAnalyzer()); Query query = parser.parse("last-modified:[1/1/04 TO 2/29/04]"); assertEquals("last-modified:[20040101 TO 20040229]", query.toString("contents")); } Now that we have our desired ... analyzer) { super(field, analyzer); } protected Query getRangeQuery(String field, Analyzer analyzer, String part1, String part2, boolean inclusive) throws ParseException { try { DateFormat df = DateFormat...
10.7.3 : Building the index
starts on page 374 under section 10.7 (I love Lucene: TheServerSide) in chapter 10 (Case studies)
... itself. You could try to use bool- ean queries to make sure that a search finds a good match ... for date-range queries. createddate_range Field.Keyword Date as a String with the format YYYYMMDD. Used for date-range queries. We created a simple Java representation of this data, SearchContentHolder, which ... an incremental build, then the results are simply limited by the SQL query that we issue to get the content ... postings with a common subject. 13 Authors' note: For more on querying multiple fields...
6.3.3 : Handling numeric field-range queries
starts on page 205 under section 6.3 (Extending QueryParser) in chapter 6 (Extending search)
... up to you. In this section, our example scenario indexes an integer id field so that range queries can ... (); } } With this index-time padding, we're only halfway there. A query expression for IDs 37 through ... the getRangeQuery() method: protected Query getRangeQuery(String field, Analyzer analyzer, String part1, String part2, boolean inclusive) throws ParseException { if ("id".equals(field)) { try { int num ... shows that the range query worked as expected, and you can see the results of the padding using Query...
4.4 : Dealing with keyword fields
starts on page 121 in chapter 4 (Analysis)
... that bypasses tokenization and is indexed exactly as is as a single term. It's also straightforward to query ... and attempt to query on Field.Keyword-created fields. The "keyword"-ness of a field is only known during ... { Query query = new TermQuery(new Term("partnum", "Q36")); No analysis Hits hits = searcher.search(query ... a document and can retrieve it using a TermQuery. But what happens if we generate a query using QueryParser? public void testBasicQueryParser() throws Exception { Query query = QueryParser.parse...
8.7 : Highlighting query terms
starts on page 300 in chapter 8 (Tools and extensions)
..., phrase, and Boolean queries and weights them based on their correspond- ing boost factor. A query must ... 1.1, includes up to three lines of the match- ing document highlighting the terms of the query. Often ... to highlight text based on a Lucene query. Figure 8.17 is an example of using Highlighter on a sample of text based on a term query for ipsum. The Highlighter code has recently evolved substantially ... the lazy dog"; TermQuery query = new TermQuery(new Term("field", "fox")); Scorer scorer = new QueryScorer...
Appendix B : Lucene index format
starts on page 394
... that Directory to the IndexSearcher class and then find Documents that match a given query by passing search terms encapsulated in the Query object to one of IndexSearcher's search methods. The results ... to specify it. However, if you like explicit code, you can call the setUse- Compound(boolean) method ... 's set- UseCompoundFiles(boolean) method at any time during indexing; the next time Lucene merges index segments ... in a new format specified via the setUseCompoundFile(boolean) method. B.3 Choosing the index...