Package org.apache.lucene.queryParser

Examples of org.apache.lucene.queryParser.MultiFieldQueryParser


        Highlighter highlighter = null;

        try
        {
            String[] queryfields = { LUCENE_PAGE_CONTENTS, LUCENE_PAGE_NAME, LUCENE_AUTHOR, LUCENE_ATTACHMENTS };
            QueryParser qp = new MultiFieldQueryParser(Version.LUCENE_36, queryfields, getLuceneAnalyzer() );

            //QueryParser qp = new QueryParser( LUCENE_PAGE_CONTENTS, getLuceneAnalyzer() );
            Query luceneQuery = qp.parse( query );

            if( (flags & FLAG_CONTEXTS) != 0 )
            {
                highlighter = new Highlighter(new SimpleHTMLFormatter("<span class=\"searchmatch\">", "</span>"),
                                              new SimpleHTMLEncoder(),
View Full Code Here


    {
        List<RepositoryContentIndex> indexes = getHashcodeIndexes( principal, selectedRepos );

        try
        {
            QueryParser parser = new MultiFieldQueryParser( new String[]{HashcodesKeys.MD5, HashcodesKeys.SHA1},
                                                            new HashcodesHandlers().getAnalyzer() );
            LuceneQuery query = new LuceneQuery( parser.parse( checksum ) );
            SearchResults results = searchAll( query, limits, indexes );
            results.getRepositories().addAll( this.localIndexedRepositories );

            return results;
        }
View Full Code Here

        Highlighter highlighter = null;

        try
        {
            String[] queryfields = { LUCENE_PAGE_CONTENTS, LUCENE_PAGE_NAME, LUCENE_AUTHOR, LUCENE_ATTACHMENTS };
            QueryParser qp = new MultiFieldQueryParser(Version.LUCENE_36, queryfields, getLuceneAnalyzer() );

            //QueryParser qp = new QueryParser( LUCENE_PAGE_CONTENTS, getLuceneAnalyzer() );
            Query luceneQuery = qp.parse( query );

            if( (flags & FLAG_CONTEXTS) != 0 )
            {
                highlighter = new Highlighter(new SimpleHTMLFormatter("<span class=\"searchmatch\">", "</span>"),
                                              new SimpleHTMLEncoder(),
View Full Code Here

    public FileContentHandlers()
    {
        analyzer = new FileContentAnalyzer();
        converter = new FileContentConverter();
        queryParser = new MultiFieldQueryParser( new String[] { FileContentKeys.FILENAME, FileContentKeys.CONTENT },
                                                 analyzer );
    }
View Full Code Here

    {
        List<RepositoryContentIndex> indexes = getHashcodeIndexes( principal, selectedRepos );

        try
        {
            QueryParser parser = new MultiFieldQueryParser( new String[]{HashcodesKeys.MD5, HashcodesKeys.SHA1},
                                                            new HashcodesHandlers().getAnalyzer() );
            LuceneQuery query = new LuceneQuery( parser.parse( checksum ) );
            SearchResults results = searchAll( query, limits, indexes, null );
            results.getRepositories().addAll( this.localIndexedRepositories );

            return results;
        }
View Full Code Here

    public BytecodeHandlers()
    {
        converter = new BytecodeEntryConverter();
        analyzer = new BytecodeAnalyzer();
        queryParser = new MultiFieldQueryParser( new String[] {
            BytecodeKeys.GROUPID,
            BytecodeKeys.ARTIFACTID,
            BytecodeKeys.VERSION,
            BytecodeKeys.CLASSIFIER,
            BytecodeKeys.TYPE,
View Full Code Here

    public HashcodesHandlers()
    {
        converter = new HashcodesEntryConverter();
        analyzer = new HashcodesAnalyzer();
        queryParser = new MultiFieldQueryParser( new String[] {
            HashcodesKeys.GROUPID,
            HashcodesKeys.ARTIFACTID,
            HashcodesKeys.VERSION,
            HashcodesKeys.CLASSIFIER,
            HashcodesKeys.TYPE,
View Full Code Here

            String[] fields = {FIELD_NAME};

            //build a query based on the fields, searchString and cached analyzer
            //NOTE: This is an area for improvement since the MultiFieldQueryParser
            // has some weirdness.
            MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, analyzer);
            Query query =parser.parse(searchString);
            //run the search
            Hits hits = is.search(query);
            //reset this list model with the new results
            resetSearchResults(hits);
        } catch (Exception e){
View Full Code Here

            }

            //build a query based on the fields, searchString and cached analyzer
            //NOTE: This is an area for improvement since the MultiFieldQueryParser
            // has some weirdness.
            MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, analyzer);
            Query query = parser.parse(searchString);
            //run the search
            Hits hits = is.search(query);
            //reset this table model with the new results
            resetSearchResults(hits);
        } catch (Exception e){
View Full Code Here

    int arraySize = indexedFields.size();
    String indexedArray[] = new String[arraySize];
    for (int ii = 0; ii < arraySize; ii++) {
      indexedArray[ii] = (String) indexedFields.get(ii);
    }
    MultiFieldQueryParser parser = new MultiFieldQueryParser(indexedArray, analyzer);
    query = parser.parse(queryString);
    System.out.println("Searching for: " + query.toString());
    return (query);

  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.queryParser.MultiFieldQueryParser

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.