Package org.apache.lucene.search

Examples of org.apache.lucene.search.WildcardQuery


    }

    private void validateIndexContents( NexusIndexer indexer )
        throws Exception
    {
        WildcardQuery q = new WildcardQuery( new Term( ArtifactInfo.UINFO, "*aopalliance*" ) );

        FlatSearchRequest request = new FlatSearchRequest( q );
        request.getContexts().add( context );

        FlatSearchResponse response = indexer.searchFlat( request );
View Full Code Here


    // but the two test explicitly testing LIMIT_EXCEEDED were just removed/commented out.

    public void testHitLimitNotReachedSingleContext()
        throws Exception
    {
        WildcardQuery q = new WildcardQuery( new Term( ArtifactInfo.UINFO, "*testng*" ) );

        FlatSearchRequest request = new FlatSearchRequest( q );
        request.setCount( 5 );
        // request.setResultHitLimit( 5 );
        request.getContexts().add( context );
View Full Code Here

    }

    public void testHitLimitEqualSingleContext()
        throws Exception
    {
        WildcardQuery q = new WildcardQuery( new Term( ArtifactInfo.UINFO, "*testng*" ) );

        FlatSearchRequest request = new FlatSearchRequest( q );
        request.setCount( 4 );
        // request.setResultHitLimit( 4 );
        request.getContexts().add( context );
View Full Code Here

    // }

    public void testHitLimitNotReachedMultipleContexts()
        throws Exception
    {
        WildcardQuery q = new WildcardQuery( new Term( ArtifactInfo.UINFO, "*testng*" ) );

        FlatSearchRequest request = new FlatSearchRequest( q );
        request.setCount( 9 );
        // request.setResultHitLimit( 9 );
        request.setArtifactInfoComparator( ArtifactInfo.REPOSITORY_VERSION_COMPARATOR );
View Full Code Here

    }

    public void testHitLimitEqualMultipleContexts()
        throws Exception
    {
        WildcardQuery q = new WildcardQuery( new Term( ArtifactInfo.UINFO, "*testng*" ) );

        FlatSearchRequest request = new FlatSearchRequest( q );
        request.setCount( 8 );
        // request.setResultHitLimit( 8 );
        request.setArtifactInfoComparator( ArtifactInfo.REPOSITORY_VERSION_COMPARATOR );
View Full Code Here

         final ValueFactoryImpl valueFactory = new ValueFactoryImpl(new LocationFactory(nsReg));
         BooleanQuery.setMaxClauseCount(Integer.MAX_VALUE);
         BooleanQuery query = new BooleanQuery();

         final String prefix = nsReg.getNamespacePrefixByURI(uri);
         query.add(new WildcardQuery(new Term(FieldNames.LABEL, prefix + ":*")), Occur.SHOULD);
         // name of the property
         query.add(new WildcardQuery(new Term(FieldNames.PROPERTIES_SET, prefix + ":*")), Occur.SHOULD);

         result = getNodes(query);

         // value of the property

         try
         {
            final Set<String> props = getFieldNames();

            query = new BooleanQuery();
            for (final String fieldName : props)
            {
               if (!FieldNames.PROPERTIES_SET.equals(fieldName))
               {
                  query.add(new WildcardQuery(new Term(fieldName, "*" + prefix + ":*")), Occur.SHOULD);
               }
            }
         }
         catch (final IndexException e)
         {
View Full Code Here

         final ValueFactoryImpl valueFactory = new ValueFactoryImpl(new LocationFactory(nsReg));
         BooleanQuery.setMaxClauseCount(Integer.MAX_VALUE);
         BooleanQuery query = new BooleanQuery();

         final String prefix = nsReg.getNamespacePrefixByURI(uri);
         query.add(new WildcardQuery(new Term(FieldNames.LABEL, prefix + ":*")), Occur.SHOULD);
         // name of the property
         query.add(new WildcardQuery(new Term(FieldNames.PROPERTIES_SET, prefix + ":*")), Occur.SHOULD);

         result = getNodes(query);

         // value of the property

         try
         {
            final Set<String> props = getFieldNames();

            query = new BooleanQuery();
            for (final String fieldName : props)
            {
               if (!FieldNames.PROPERTIES_SET.equals(fieldName))
               {
                  query.add(new WildcardQuery(new Term(fieldName, "*" + prefix + ":*")), Occur.SHOULD);
               }
            }
         }
         catch (final IndexException e)
         {
View Full Code Here

         final ValueFactoryImpl valueFactory = new ValueFactoryImpl(new LocationFactory(nsReg), cleanerHolder);
         BooleanQuery.setMaxClauseCount(Integer.MAX_VALUE);
         BooleanQuery query = new BooleanQuery();

         final String prefix = nsReg.getNamespacePrefixByURI(uri);
         query.add(new WildcardQuery(new Term(FieldNames.LABEL, prefix + ":*")), Occur.SHOULD);
         // name of the property
         query.add(new WildcardQuery(new Term(FieldNames.PROPERTIES_SET, prefix + ":*")), Occur.SHOULD);

         result = getNodes(query);

         // value of the property

         try
         {
            final Set<String> props = getFieldNames();

            query = new BooleanQuery();
            for (final String fieldName : props)
            {
               if (!FieldNames.PROPERTIES_SET.equals(fieldName))
               {
                  query.add(new WildcardQuery(new Term(fieldName, "*" + prefix + ":*")), Occur.SHOULD);
               }
            }
         }
         catch (final IndexException e)
         {
View Full Code Here

                aField = "content";
            }

            Query aQuery;
            if (aQueryStr.endsWith("*")) {
                aQuery = new WildcardQuery(new Term(aField, aQueryStr));
            } else {
                aQuery = new TermQuery(new Term(aField, aQueryStr));
            }

            // Perform search
View Full Code Here

  @Override
  public void readFields(DataInput in) throws IOException {
    float boost = in.readFloat();
    TermWritable termWritable = new TermWritable();
    termWritable.readFields(in);
    query = new WildcardQuery(termWritable.getTerm());
    query.setBoost(boost);
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.WildcardQuery

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.