Package org.apache.xindice.core.indexer

Examples of org.apache.xindice.core.indexer.LuceneIndexer


            IndexPattern pattern = new IndexPattern(symbols, ps, nsMap);

            // check if there is full text indexer for this collection
            Indexer idx = context.getIndexManager().getBestIndexer(Indexer.STYLE_FULLTEXT, pattern);
            if (idx instanceof LuceneIndexer) {
                LuceneIndexer textInd = ((LuceneIndexer) idx);
                analyzer = textInd.getAnalyzer();
                parameters.put(PARAM_ANALYZER, analyzer);

                // see if index has matching pattern
                String alias = textInd.getPatternAlias(pattern);

                if (alias != null) {
                    // Queries that contain 'NOT', '!', '-' operators cannot be used here
                    // because LuceneIndexer searches for documents, in that context
                    // "NOT term" query means to find documents where 'term' does not
                    // appear in certain field at all. For XPath, however, it means that
                    // 'term' must not appear in text of the element that currently under
                    // evaluation, but may appear in the other elements that match the
                    // same IndexPattern.
                    //
                    // To make sure that all potentially matching documents are returned
                    // by the search, all subqueries with these operators are ignored
                    // on this step.
                    org.apache.lucene.search.Query parsedQuery = new SpecialQueryParser(alias, analyzer).parse(query);
                    IndexMatch[] matches = textInd.queryMatches(parsedQuery);
                    Key[] keys = QueryEngine.getUniqueKeys(matches);

                    return new NamedKeys(ps, ps.indexOf('@') != -1, keys);
                }
            } else {
View Full Code Here


            String alias = (String) i.next();
            config += "<pattern pattern='" + patterns.get(alias) + "' alias='" + alias + "' />";
        }
        config += "</index>";

        LuceneIndexer ind = (LuceneIndexer) collection.createIndexer(new Configuration(DOMParser.toDocument(config)));
        Thread.sleep(2000);
        return ind;
    }
View Full Code Here

TOP

Related Classes of org.apache.xindice.core.indexer.LuceneIndexer

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.