Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Aleksandra Tsys
Suggester
Commits
8ffd7454
Commit
8ffd7454
authored
Mar 17, 2021
by
tssasha
Browse files
solr debugging
parent
b70e25d0
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
fuzzy_gradle/.gradle/checksums/checksums.lock
View file @
8ffd7454
No preview for this file type
fuzzy_gradle/.gradle/checksums/md5-checksums.bin
View file @
8ffd7454
No preview for this file type
fuzzy_gradle/.gradle/checksums/sha1-checksums.bin
View file @
8ffd7454
No preview for this file type
fuzzy_gradle/src/main/java/org/apache/lucene/search/suggest/analyzing/ContextAnalyzingSuggester.java
View file @
8ffd7454
...
...
@@ -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
);
Util
Debug
.
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
);
Util
Debug
.
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
;
Util
Debug
.
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
;
Util
Debug
.
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
)
{
...
...
fuzzy_gradle/src/main/java/org/apache/lucene/util/fst/UtilDebug.java
0 → 100644
View file @
8ffd7454
This diff is collapsed.
Click to expand it.
yelp/conf/solrconfig.xml
View file @
8ffd7454
...
...
@@ -332,8 +332,8 @@
<str
name=
"suggestAnalyzerFieldType"
>
string
</str>
<!--<str name="suggestAnalyzerFieldType">textSuggest</str>-->
<str
name=
"payloadField"
>
id
</str>
<str
name=
"buildOnStartup"
>
fals
e
</str>
<str
name=
"buildOnCommit"
>
fals
e
</str>
<str
name=
"buildOnStartup"
>
tru
e
</str>
<str
name=
"buildOnCommit"
>
tru
e
</str>
</lst>
</searchComponent>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment