Class SearchIndex
- java.lang.Object
-
- in.cdac.medinfo.csnotk.csnolib.luceneindexutils.SearchIndex
-
- All Implemented Interfaces:
java.io.Serializable
public class SearchIndex extends java.lang.Object implements java.io.SerializableImplementation of document search functionality with Lucene version 8.7.0. Search functionality is provided by this class.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringLOINC_MODULEID
-
Constructor Summary
Constructors Constructor Description SearchIndex()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<CompositeDescription>getTopDescriptions(org.apache.lucene.search.ScoreDoc[] results, java.lang.String term, java.lang.String refsetId, boolean fullConcept)Searches for the top matching descriptions.Conceptsearch(java.lang.String conceptId)Searches given conceptId in the SNOMED CT repositoryjava.util.Set<CompositeDescription>search(java.util.HashMap<java.lang.String,java.util.List<java.lang.String>> queryParams, boolean fullConcept)Searches given term/text or concept id in the SNOMED CT repository based on provided component state, semantic tag, acceptability.org.apache.lucene.search.ScoreDoc[]search(org.apache.lucene.search.Query query, int returnLimitPerPage, java.lang.String refsetId)Searches for a particular input query in the index.java.util.List<Identifier>searchAlternateIdentifiers(java.lang.String id, java.lang.String moduleId)Searches for alternate identifiers of a SNOMED concept.IdentifiersearchLOINC(java.lang.String id)Searches the LOINC code / SNOMED ID of code provided .SimpleMapRefsetResultsearchSimpleMap(java.lang.String refsetComponentId)Searches the simpleMapTarget of refsetComponentId provided .
-
-
-
Field Detail
-
LOINC_MODULEID
public static final java.lang.String LOINC_MODULEID
- See Also:
- Constant Field Values
-
-
Method Detail
-
search
public org.apache.lucene.search.ScoreDoc[] search(org.apache.lucene.search.Query query, int returnLimitPerPage, java.lang.String refsetId) throws java.io.IOExceptionSearches for a particular input query in the index.- Parameters:
query- input query i.e. the term to be searched.returnLimitPerPage- returnLimit per page.inOrder- whether the results should be in order.refsetId- Identifier of Refset- Returns:
- scoreDocs ScoreDoc array that contains list of top scoring results.
- Throws:
java.io.IOException- if any error occurs while processing.
-
getTopDescriptions
public java.util.Set<CompositeDescription> getTopDescriptions(org.apache.lucene.search.ScoreDoc[] results, java.lang.String term, java.lang.String refsetId, boolean fullConcept) throws java.io.IOException, java.text.ParseException
Searches for the top matching descriptions.- Parameters:
results- array ofScoreDocelements.refsetId- Identifier of Refset- Returns:
- descriptions set of
CompositeDescriptions. - Throws:
java.io.IOException- if any error occurs while processing.java.text.ParseException
-
search
public java.util.Set<CompositeDescription> search(java.util.HashMap<java.lang.String,java.util.List<java.lang.String>> queryParams, boolean fullConcept)
Searches given term/text or concept id in the SNOMED CT repository based on provided component state, semantic tag, acceptability.- Parameters:
queryParams- Hashmap containing key value pair of search parameters on the basis of which search criteria will be decided. Parameters are as follows,
SearchTerm -Stringterm/text or Concept ID to be searched in SNOMED CT repository.
State -EnumStateState of a component.
If enumState is,
active - It will return only active Components.
inactive - It will return only inactive Components.
both - It will return both active and inactive Components.
SemanticTag -EnumSemanticTagRefers to the Semantic Tag in which SNOMED CT term/text or concept id will be searched.
If enumSemanticTag is,
all - It will search SNOMED CT term in all the Semantic Tags.
For other possible values please referEnumSemanticTag.
A list ofEnumSemanticTagcan also be provide in which search/suggest is to be perform.
Acceptability -EnumAcceptabilityRepresents the type of description i.e. whether the search results contains preferred terms or preferred terms other than FSN or only acceptable terms and so on.
If enumAcceptability is,
all - refers to all description for a concept (both preferred and acceptable).
preferred - refers to all preferred description for a concept (including FSN).
preferredexcludingfsn - refers to SNOMEDCT description for preferred terms excluding FSN.
synonyms - refers to all description for a concept (excluding FSN).
acceptable- refers to all description for a concept excluding preferred.
returnLimit/MaxRecords - Maximum number of matching terms to be fetched.
groupByConcept - boolean value, if true, then method will return set ofCompositeDescriptionwhich will contain one description from one concept.
refsetId - Identifier of Refset from which search is to be done and null if search is to be done from whole SNOMED CT Terminology
- Returns:
- Set of
CompositeDescriptionmatching the given term/text or Concept ID.
-
search
public Concept search(java.lang.String conceptId) throws java.io.IOException, java.text.ParseException, org.apache.lucene.queryparser.classic.ParseException
Searches given conceptId in the SNOMED CT repository- Parameters:
conceptId- String it will search on the basis of given conceptId and also use for checking the entered conceptId is valid or not- Returns:
- Object of
Conceptrespected to given conceptId - Throws:
org.apache.lucene.queryparser.classic.ParseExceptionjava.io.IOExceptionjava.text.ParseException
-
searchSimpleMap
public SimpleMapRefsetResult searchSimpleMap(java.lang.String refsetComponentId) throws java.text.ParseException, java.io.IOException, org.apache.lucene.queryparser.classic.ParseException
Searches the simpleMapTarget of refsetComponentId provided .- Parameters:
queryParams-- Returns:
- SimpleMapRefsetResult mapped to the given Refset Component ID.
- Throws:
java.io.IOExceptionorg.apache.lucene.queryparser.classic.ParseExceptionorg.apache.lucene.queryparser.classic.ParseExceptionjava.text.ParseException
-
searchLOINC
public Identifier searchLOINC(java.lang.String id) throws java.text.ParseException, java.io.IOException, org.apache.lucene.queryparser.classic.ParseException
Searches the LOINC code / SNOMED ID of code provided .- Parameters:
queryParams-- Returns:
- Identifier mapped to the given code.
- Throws:
java.io.IOExceptionorg.apache.lucene.queryparser.classic.ParseExceptionorg.apache.lucene.queryparser.classic.ParseExceptionjava.text.ParseException
-
searchAlternateIdentifiers
public java.util.List<Identifier> searchAlternateIdentifiers(java.lang.String id, java.lang.String moduleId) throws java.text.ParseException, java.io.IOException, org.apache.lucene.queryparser.classic.ParseException
Searches for alternate identifiers of a SNOMED concept.- Parameters:
queryParams-- Returns:
- Identifier mapped to the given code.
- Throws:
java.io.IOExceptionorg.apache.lucene.queryparser.classic.ParseExceptionorg.apache.lucene.queryparser.classic.ParseExceptionjava.text.ParseException
-
-