Java Code Examples for org.apache.lucene.queries.function.FunctionValues#boolVal()
The following examples show how to use
org.apache.lucene.queries.function.FunctionValues#boolVal() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValueSourceParser.java From lucene-solr with Apache License 2.0 | 6 votes |
@Override public ValueSource parse(FunctionQParser fp) throws SyntaxError { List<ValueSource> sources = fp.parseValueSourceList(); return new MultiBoolFunction(sources) { @Override protected String name() { return "and"; } @Override protected boolean func(int doc, FunctionValues[] vals) throws IOException { for (FunctionValues dv : vals) if (!dv.boolVal(doc)) return false; return true; } }; }
Example 2
Source File: ValueSourceParser.java From lucene-solr with Apache License 2.0 | 6 votes |
@Override public ValueSource parse(FunctionQParser fp) throws SyntaxError { List<ValueSource> sources = fp.parseValueSourceList(); return new MultiBoolFunction(sources) { @Override protected String name() { return "or"; } @Override protected boolean func(int doc, FunctionValues[] vals) throws IOException { for (FunctionValues dv : vals) if (dv.boolVal(doc)) return true; return false; } }; }
Example 3
Source File: ValueSourceParser.java From lucene-solr with Apache License 2.0 | 6 votes |
@Override public ValueSource parse(FunctionQParser fp) throws SyntaxError { List<ValueSource> sources = fp.parseValueSourceList(); return new MultiBoolFunction(sources) { @Override protected String name() { return "xor"; } @Override protected boolean func(int doc, FunctionValues[] vals) throws IOException { int nTrue=0, nFalse=0; for (FunctionValues dv : vals) { if (dv.boolVal(doc)) nTrue++; else nFalse++; } return nTrue != 0 && nFalse != 0; } }; }
Example 4
Source File: ValueSourceParser.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public ValueSource parse(FunctionQParser fp) throws SyntaxError { ValueSource vs = fp.parseValueSource(); return new SimpleBoolFunction(vs) { @Override protected boolean func(int doc, FunctionValues vals) throws IOException { return !vals.boolVal(doc); } @Override protected String name() { return "not"; } }; }