NIH | National Cancer Institute | NCI Wiki  

Error rendering macro 'rw-search'

null

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Table of Contents

Goal

The goal of the decoupling is to remove references of a specific search implementation (Lucene in this case) from the LexEVS API layer.  

Approach

The approach will be to start by updating to Lucene 5.0 and fix all of the old references.  Once this is complete, we will next look at decoupling Lucene from the LexEVS API layer.  This is described in more detail below.  Note that the decoupling task could be done at any point in the Lucene upgrade.

Design

There are several Lucene objects that need to be considered when decoupling Lucene from LexEVS.  We will need to abstract this types when decoupling.  Some of these Lucene objects include:

  • AbstractLazyCodeHolderFactory 
    • org.apache.lucene.search.BooleanQuery;
    •  org.apache.lucene.search.Filter;
    •  org.apache.lucene.search.FilteredQuery;
    •  org.apache.lucene.search.Query;
    •  org.apache.lucene.search.ScoreDoc;
    •  org.apache.lucene.search.BooleanClause.Occur;
    •  org.compass.core.lucene.support.ChainedFilter;
  • CodedNodeSetImpl
    • org.apache.lucene.search.BooleanQuery;
    •   org.apache.lucene.search.MatchAllDocsQuery;
    •  org.apache.lucene.search.Query;
    •  org.apache.lucene.search.BooleanClause.Occur;

 

There are specific cases of logic that will need to evaluated when doing the actual implementation.  These cases include code where Lucene objects are intermixed throughout LexEVS methods.  An example of this would be here:
  • AbstractLazyCodeHolderFactory. buildCodeHolderWithFilters()
  • CodedNodeSetImpl.runPendingOps()


Different Lucene Query methods that could be pulled out of CodedNodeSetImpl and AbstractLazyCodeHolderFactory.  These methods can be pushed into an implementation of the Query interface below.  The interface will be used instead of calling Lucene directly.

Query Interface
//code decoupling

// Interface for creating Queries
public interface Query {

	// methods required for CodedNodeSetImpl 
	public  Query getCodingSchemeQuery(String uri, String internalVersionString);  
	public  Query getRestrictionQuery(Restriction restriction, String internalCodeSystemName, String internalVersionString);  

	// methods required for AbstractLazyCodeHolderFactory
	private  Query getBooleanQuery(List<Query> queries);
	public Query getFilteredQuery(List<Filter> filters, BooleanQuery combinedQuery, Filter chainedFilter);
}

// Lucene Implementation
public class LuceneQuery implements Query {

}

 

Interface for a ScoreDoc Factory.  AbstractLazyCodeHolderFactory.buildCodeHolder is currently using ScoreDocs.

ScoreDocFactory
public interface ScoreDocFactory {

     List<ScoreDoc> getScoreDocs (EntityIndexService service, AbsoluteCodingSchemeVersionReference ref, List<BooleanQuery> combinedQuery,List<Query> bitSetQueries);
}

 

Need to define different types of Queries and Filters.  Create an abstract class for each of them.  CodedNodeSetImpl and AbstractLazyCodeHolderFactory will not need to reference Lucene objects directly then.

Abstract QueryType
// Potential abstract classes for defining different types of Lucene objects in a generic manner.
public abstract class QueryType {
}

public abstract class FilterType {
}

public abstract class FilteredQuery {
}

  • No labels