Package org.sindice.siren.search.node

Examples of org.sindice.siren.search.node.NodeTermQuery$NodeTermWeight


    final HashMap<String, Analyzer> dtAnalyzers = new HashMap<String, Analyzer>();
    dtAnalyzers.put(XSDDatatype.XSD_STRING, new WhitespaceAnalyzer(LuceneTestCase.TEST_VERSION_CURRENT));
    config.put(KeywordConfigurationKeys.DATATYPES_ANALYZERS, dtAnalyzers);
    final NodeBooleanQuery complex = new NodeBooleanQuery();
    complex.add(new NodeRegexpQuery(new Term(df, "[a-z]\\/[123]")), NodeBooleanClause.Occur.MUST);
    complex.add(new NodeTermQuery(new Term(df, "/etc/init.d/")), Occur.MUST);
    complex.add(new NodeTermQuery(new Term(df, "/etc/init[.]d/lucene/")), Occur.SHOULD);
    this._assertSirenQuery(config, complex, "+/[a-z]\\/[123]/ +\"/etc/init.d/\" OR \"/etc\\/init\\[.\\]d/lucene/\" ");

    Query re = new NodeRegexpQuery(new Term(df, "http.*"));
    this._assertSirenQuery(config, re, "/http.*/");

    re = new NodeRegexpQuery(new Term(df, "http~0.5"));
    this._assertSirenQuery(config, re, "/http~0.5/");

    re = new NodeRegexpQuery(new Term(df, "boo"));
    this._assertSirenQuery(config, re, "/boo/");

    this._assertSirenQuery(config, new NodeTermQuery(new Term(df, "/boo/")), "\"/boo/\"");
    this._assertSirenQuery(config, new NodeTermQuery(new Term(df, "/boo/")), "\\/boo\\/");

    config.put(ConfigurationKeys.DEFAULT_OPERATOR, Operator.OR);
    final NodeBooleanQuery two = new NodeBooleanQuery();
    two.add(new NodeRegexpQuery(new Term(df, "foo")), Occur.SHOULD);
    two.add(new NodeRegexpQuery(new Term(df, "bar")), Occur.SHOULD);
View Full Code Here


    protected final NodeTermQuery ntq;

    private NodeTermQueryBuilder(final String fieldName, final String term) {
      final Term t = new Term(fieldName, term);
      ntq = new NodeTermQuery(t);
    }
View Full Code Here

  private SolrQuery getJsonQuery() throws QueryNodeException {
    final SolrQuery query = new SolrQuery();
    query.setRequestHandler("json");

    // Use the SIREn core API for building query expressions.
    final NodeTermQuery uri = new NodeTermQuery(new Term("", "www.sourcelondon.net"));
    uri.setDatatype("uri");

    final NodeTermQuery website = new NodeTermQuery(new Term("", "Website"));
    website.setDatatype("json:field");

    final NodeTermQuery owner = new NodeTermQuery(new Term("", "DeviceOwner"));
    owner.setDatatype("json:field");

    // Use the query builder to create twig query using the JSON query syntax.
    final QueryBuilder builder = new QueryBuilder();
    final TwigQuery twq = builder.newTwig(owner.toString("json"))
                           .with(
                             builder.newTwig(website.toString("json"))
                                    .with(builder.newNode(uri.toString("json"))),
                             2);
View Full Code Here

  }

  public NodeTermQuery build(QueryNode queryNode) throws QueryNodeException {
    final FieldQueryNode fieldNode = (FieldQueryNode) queryNode;
   
    return new NodeTermQuery(new Term(fieldNode.getFieldAsString(), fieldNode
        .getTextAsString()));
  }
View Full Code Here

    final NodePhraseQuery phraseQuery = new NodePhraseQuery();
    final List<QueryNode> children = phraseNode.getChildren();

    if (children != null) {
      for (final QueryNode child : children) {
        final NodeTermQuery termQuery = (NodeTermQuery) child
            .getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
        final FieldQueryNode termNode = (FieldQueryNode) child;
        phraseQuery.add(termQuery.getTerm(), termNode.getPositionIncrement());
      }
    }
    return phraseQuery;
  }
View Full Code Here

TOP

Related Classes of org.sindice.siren.search.node.NodeTermQuery$NodeTermWeight

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.