Commit 8ffd7454 authored by tssasha's avatar tssasha
Browse files

solr debugging

parent b70e25d0
......@@ -24,6 +24,7 @@ import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.io.*;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
......@@ -52,16 +53,13 @@ import org.apache.lucene.util.automaton.Automaton;
import org.apache.lucene.util.automaton.LimitedFiniteStringsIterator;
import org.apache.lucene.util.automaton.Operations;
import org.apache.lucene.util.automaton.Transition;
import org.apache.lucene.util.fst.Builder;
import org.apache.lucene.util.fst.ByteSequenceOutputs;
import org.apache.lucene.util.fst.*;
import org.apache.lucene.util.fst.FST.BytesReader;
import org.apache.lucene.util.fst.FST;
import org.apache.lucene.util.fst.PairOutputs.Pair;
import org.apache.lucene.util.fst.PairOutputs;
import org.apache.lucene.util.fst.PositiveIntOutputs;
import org.apache.lucene.util.fst.Util.Result;
import org.apache.lucene.util.fst.Util.TopResults;
import org.apache.lucene.util.fst.Util;
//import org.apache.lucene.util.fst.Util.Result;
//import org.apache.lucene.util.fst.Util.TopResults;
import org.apache.lucene.util.fst.UtilDebug.Result;
import org.apache.lucene.util.fst.UtilDebug.TopResults;
import static org.apache.lucene.util.automaton.Operations.DEFAULT_MAX_DETERMINIZED_STATES;
......@@ -414,7 +412,7 @@ public class ContextAnalyzingSuggester extends Lookup implements Accountable {
new LimitedFiniteStringsIterator(toAutomaton(surfaceForm, ts2a), maxGraphExpansions);
for (IntsRef string; (string = finiteStrings.next()) != null; count++) {
Util.toBytesRef(string, scratch);
UtilDebug.toBytesRef(string, scratch);
// length of the analyzed text (FST input)
if (scratch.length() > Short.MAX_VALUE-2) {
......@@ -554,7 +552,7 @@ public class ContextAnalyzingSuggester extends Lookup implements Accountable {
analyzed.append((byte) 0);
analyzed.append((byte) dedup);
Util.toIntsRef(analyzed.get(), scratchInts);
UtilDebug.toIntsRef(analyzed.get(), scratchInts);
//System.out.println("ADD: " + scratchInts + " -> " + cost + ": " + surface.utf8ToString());
if (!hasPayloads) {
fstCompiler.add(scratchInts.get(), outputs.newPair(cost, BytesRef.deepCopyOf(surface)));
......@@ -703,9 +701,10 @@ public class ContextAnalyzingSuggester extends Lookup implements Accountable {
// Searcher just to find the single exact only
// match, if present:
Util.TopNSearcher<Pair<Long,BytesRef>> searcher;
UtilDebug.TopNSearcher<Pair<Long,BytesRef>> searcher;
System.out.println("point3");
searcher = new Util.TopNSearcher<Pair<Long,BytesRef>>(fst,
System.out.format("topN: %d", count * maxSurfaceFormsPerAnalyzedForm);
searcher = new UtilDebug.TopNSearcher<Pair<Long, BytesRef>>(fst,
count * maxSurfaceFormsPerAnalyzedForm,
count * maxSurfaceFormsPerAnalyzedForm, weightComparator) {
@Override
......@@ -741,6 +740,7 @@ public class ContextAnalyzingSuggester extends Lookup implements Accountable {
if (fst.findTargetArc(END_BYTE, path.fstNode, scratchArc, bytesReader) != null) {
// This node has END_BYTE arc leaving, meaning it's an
// "exact" match:
System.out.println("add_point");
searcher.addStartPaths(scratchArc, fst.outputs.add(path.output, scratchArc.output()), false, path.input);
}
}
......@@ -774,9 +774,10 @@ public class ContextAnalyzingSuggester extends Lookup implements Accountable {
}
}
Util.TopNSearcher<Pair<Long,BytesRef>> searcher;
UtilDebug.TopNSearcher<Pair<Long,BytesRef>> searcher;
System.out.println("point6");
searcher = new Util.TopNSearcher<Pair<Long,BytesRef>>(fst,
System.out.format("topN: %d ", num - results.size());
searcher = new UtilDebug.TopNSearcher<Pair<Long, BytesRef>>(fst,
num - results.size(),
num * maxAnalyzedPathsForOneInput,
weightComparator) {
......
......@@ -332,8 +332,8 @@
<str name="suggestAnalyzerFieldType">string</str>
<!--<str name="suggestAnalyzerFieldType">textSuggest</str>-->
<str name="payloadField">id</str>
<str name="buildOnStartup">false</str>
<str name="buildOnCommit">false</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">true</str>
</lst>
</searchComponent>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment