Class SearchIndex

  • All Implemented Interfaces:
    java.io.Serializable

    public class SearchIndex
    extends java.lang.Object
    implements java.io.Serializable
    Implementation 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.String LOINC_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.
      Concept search​(java.lang.String conceptId)
      Searches given conceptId in the SNOMED CT repository
      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.
      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.
      Identifier searchLOINC​(java.lang.String id)
      Searches the LOINC code / SNOMED ID of code provided .
      SimpleMapRefsetResult searchSimpleMap​(java.lang.String refsetComponentId)
      Searches the simpleMapTarget of refsetComponentId provided .
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SearchIndex

        public SearchIndex()
    • 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.IOException
        Searches 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 of ScoreDoc elements.
        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 - String term/text or Concept ID to be searched in SNOMED CT repository.

        State - EnumState State 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 - EnumSemanticTag Refers 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 refer EnumSemanticTag.

        A list of EnumSemanticTag can also be provide in which search/suggest is to be perform.
        Acceptability - EnumAcceptability Represents 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 of CompositeDescription which 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 CompositeDescription matching 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 Concept respected to given conceptId
        Throws:
        org.apache.lucene.queryparser.classic.ParseException
        java.io.IOException
        java.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.IOException
        org.apache.lucene.queryparser.classic.ParseException
        org.apache.lucene.queryparser.classic.ParseException
        java.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.IOException
        org.apache.lucene.queryparser.classic.ParseException
        org.apache.lucene.queryparser.classic.ParseException
        java.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.IOException
        org.apache.lucene.queryparser.classic.ParseException
        org.apache.lucene.queryparser.classic.ParseException
        java.text.ParseException