Package com.bericotech.clavin.resolver

Examples of com.bericotech.clavin.resolver.ResolvedLocation


                    }
                }   
            }
            // just pick SOMETHING!
            if(!foundOne){
                ResolvedLocation candidate = candidates.get(0);
                logResolvedLocationInfo(candidate);
                bestCandidates.add(candidate);
                possibilitiesToRemove.add(candidates);
            }
        }
View Full Code Here


            // see if anything was found
            if (results.scoreDocs.length > 0) {
                // one or more exact String matches found for this location name
                for (int i = 0; i < results.scoreDocs.length; i++) {
                    // add each matching location to the list of candidates
                    ResolvedLocation location = new ResolvedLocation(indexSearcher.doc(results.scoreDocs[i].doc), locationName, false);
                    logger.debug("{}", location);
                    candidateMatches.add(location);
                }
            } else if (fuzzy) { // only if fuzzy matching is turned on
                // no exact String matches found -- fallback to fuzzy search
               
                // Using the tilde "~" makes this a fuzzy search. I compared this to FuzzyQuery
                // with TopTermsBoostOnlyBooleanQueryRewrite, I like the output better this way.
                // With the other method, we failed to match things like "Stra��enhaus Airport"
                // as <Stra��enhaus>, and the match scores didn't make as much sense.
                q = new AnalyzingQueryParser(Version.LUCENE_40, "indexName", indexAnalyzer).parse(sanitizedLocationName + "~");
               
                // collect all the fuzzy matches up to maxHits, and sort
                // them based on Lucene match score and population for the
                // associated GeoNames record
                results = indexSearcher.search(q, null, maxHitDepth, populationSort);
               
                // see if anything was found with fuzzy matching
                if (results.scoreDocs.length > 0) {
                    // one or more fuzzy matches found for this location name
                    for (int i = 0; i < results.scoreDocs.length; i++) {
                        // add each matching location to the list of candidates
                        ResolvedLocation location = new ResolvedLocation(indexSearcher.doc(results.scoreDocs[i].doc), locationName, true);
                        logger.debug(location + "{fuzzy}");
                        candidateMatches.add(location);
                    }
                } else {
                    // drats, foiled again! no fuzzy matches found either!
View Full Code Here

          // see if anything was found
          if (results.scoreDocs.length > 0) {
            // one or more exact String matches found for this location name
            for (int i = 0; i < results.scoreDocs.length; i++) {
              // add each matching location to the list of candidates
              ResolvedLocation location = new ResolvedLocation(indexSearcher.doc(results.scoreDocs[i].doc), locationName, false);
              logger.debug("{}", location);
              candidateMatches.add(location);
            }
          } else if (fuzzy) { // only if fuzzy matching is turned on
            // no exact String matches found -- fallback to fuzzy search
           
            // Using the tilde "~" makes this a fuzzy search. I compared this to FuzzyQuery
            // with TopTermsBoostOnlyBooleanQueryRewrite, I like the output better this way.
            // With the other method, we failed to match things like "Stra��enhaus Airport"
            // as <Stra��enhaus>, and the match scores didn't make as much sense.
            q = new AnalyzingQueryParser(Version.LUCENE_40, "indexName", indexAnalyzer).parse(sanitizedLocationName + "~");
           
            // collect all the fuzzy matches up to maxHits, and sort
            // them based on Lucene match score and population for the
            // associated GeoNames record
            results = indexSearcher.search(q, null, maxHitDepth, populationSort);
           
            // see if anything was found with fuzzy matching
            if (results.scoreDocs.length > 0) {
              // one or more fuzzy matches found for this location name
              for (int i = 0; i < results.scoreDocs.length; i++) {
                // add each matching location to the list of candidates
                ResolvedLocation location = new ResolvedLocation(indexSearcher.doc(results.scoreDocs[i].doc), locationName, true);
                  logger.debug(location + "{fuzzy}");
                  candidateMatches.add(location);
              }
            } else {
              // drats, foiled again! no fuzzy matches found either!
View Full Code Here

TOP

Related Classes of com.bericotech.clavin.resolver.ResolvedLocation

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.