On Wed, 2017-06-21 at 12:04 +0300, Robert Munteanu wrote: > Hi, > > I am building off the maven-indexer examples and trying to find > artifacts with a certain Bundle-SymbolicName. I have configured the > OSGi indexer before downloading the index > > List<IndexCreator> indexers = new ArrayList<>(); > indexers.add(plexusContainer.lookup(IndexCreator.class, "min")); > indexers.add(plexusContainer.lookup(IndexCreator.class, > "jarContent")); > indexers.add(plexusContainer.lookup(IndexCreator.class, "maven- > plugin")); > indexers.add(plexusContainer.lookup(IndexCreator.class, "osgi- > metadatas")); > > and am firing off a query for the BSN field > > BooleanQuery q = new BooleanQuery(); > q.add(indexer.constructQuery(OSGI.SYMBOLIC_NAME, new > SourcedSearchExpression(bsn)), Occur.MUST); > >
Just to answer my own question, I am now using a StringSearchExpression instead of a SourcedSearchExpression. The downside is that the matches are not exact, so I need to filter again when the results come in. Not ideal, but workable. If there's a better solution I would be happy to see it. Thanks, Robert > When running the search I get a logged warning > > [WARNING] EXACT type of querying for non-keyword (but stored) field > urn:osgi#exportPackage (with 1 registered index fields) was tried. > Please review your code, or indexCreator involved, since this type of > querying of this field is currently unsupported. > > and then a NPE ( see end of mail ). > > What am I doing wrong? My understanding is that these fields should > be > available for querying. Is there another way of querying for this > data? > > Thanks, > > Robert > > (Please keep me in CC, I am not subscribed to this mailing list) > > Exception in thread "main" java.lang.NullPointerException > at > org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:363) > at > org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:592 > ) > at > org.apache.lucene.search.Searcher.createNormalizedWeight(Searcher.jav > a: > 167) > at > org.apache.lucene.search.IndexSearcher.createNormalizedWeight(IndexSe > ar > cher.java:664) > at > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:383) > at > org.apache.maven.index.DefaultSearchEngine.doSearchWithCeiling(Defaul > tS > earchEngine.java:336) > at > org.apache.maven.index.DefaultSearchEngine.searchIteratorPaged(Defaul > tS > earchEngine.java:280) > at > org.apache.maven.index.DefaultSearchEngine.forceSearchIteratorPaged(D > ef > aultSearchEngine.java:264) > at > org.apache.maven.index.DefaultIndexer.searchIterator(DefaultIndexer.j > av > a:157) > at > nu.muntea.ca.maven.impl.OsgiArtifactLocator.searchForSlingBundles(Osg > iA > rtifactLocator.java:137) > at > nu.muntea.ca.maven.impl.OsgiArtifactLocator.run(OsgiArtifactLocator.j > av > a:118) > at > nu.muntea.ca.maven.impl.OsgiArtifactLocator.main(OsgiArtifactLocator. > ja > va:47) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
