32
32
33
33
34
34
public class SearchIndexManager {
35
- private AzureSearchClientFactory searchInfo ;
35
+ private AzureSearchClientFactory azureSearchClientFactory ;
36
36
private String searchAnalyzerName ;
37
37
private boolean useAcls ;
38
38
private TextEmbeddingsService embeddingsService ;
39
39
private static final Logger logger = LoggerFactory .getLogger (SearchIndexManager .class );
40
40
41
- public SearchIndexManager (AzureSearchClientFactory searchInfo , String searchAnalyzerName , TextEmbeddingsService embeddingsService ) {
42
- this .searchInfo = searchInfo ;
41
+ public SearchIndexManager (AzureSearchClientFactory azureSearchClientFactory , String searchAnalyzerName , TextEmbeddingsService embeddingsService ) {
42
+ this .azureSearchClientFactory = azureSearchClientFactory ;
43
43
this .searchAnalyzerName = searchAnalyzerName ;
44
44
this .embeddingsService = embeddingsService ;
45
45
}
46
46
47
47
public void createIndex () {
48
- if (searchInfo .isVerbose ()) {
49
- logger .debug ("Ensuring search index {} exists" , searchInfo .getIndexName ());
48
+ if (azureSearchClientFactory .isVerbose ()) {
49
+ logger .debug ("Ensuring search index {} exists" , azureSearchClientFactory .getIndexName ());
50
50
}
51
51
52
52
53
- SearchIndexClient searchIndexClient = searchInfo .createSearchIndexClient ();
53
+ SearchIndexClient searchIndexClient = azureSearchClientFactory .createSearchIndexClient ();
54
54
SearchIndex index = null ;
55
55
try {
56
- index = searchIndexClient .getIndex (searchInfo .getIndexName ());
56
+ index = searchIndexClient .getIndex (azureSearchClientFactory .getIndexName ());
57
57
}catch (HttpResponseException httpEx ) {
58
58
if (httpEx .getResponse ().getStatusCode () == 404 )
59
- logger .info ("index {} does not exist. Creating.." , searchInfo .getIndexName ());
59
+ logger .info ("index {} does not exist. Creating.." , azureSearchClientFactory .getIndexName ());
60
60
}
61
61
62
62
if ( index != null ) {
63
- logger .info ("index {} already exists. Skipping creation" , searchInfo .getIndexName ());
63
+ logger .info ("index {} already exists. Skipping creation" , azureSearchClientFactory .getIndexName ());
64
64
return ;
65
65
}
66
66
@@ -109,7 +109,7 @@ public void createIndex() {
109
109
.setFilterable (true ));
110
110
}
111
111
112
- index = new SearchIndex (searchInfo .getIndexName (), fields );
112
+ index = new SearchIndex (azureSearchClientFactory .getIndexName (), fields );
113
113
114
114
index .setSemanticSearch (new SemanticSearch ().setConfigurations (Arrays .asList (new SemanticConfiguration (
115
115
"default" , new SemanticPrioritizedFields ()
@@ -125,7 +125,7 @@ public void createIndex() {
125
125
126
126
searchIndexClient .createIndex (index );
127
127
128
- logger .info ("Created index {}" , searchInfo .getIndexName ());
128
+ logger .info ("Created index {}" , azureSearchClientFactory .getIndexName ());
129
129
}
130
130
131
131
public void updateContent (List <Section > sections ) {
@@ -135,7 +135,7 @@ public void updateContent(List<Section> sections) {
135
135
sectionBatches .add (sections .subList (i , Math .min (i + MAX_BATCH_SIZE , sections .size ())));
136
136
}
137
137
138
- SearchClient searchClient = searchInfo .createSearchClient ();
138
+ SearchClient searchClient = azureSearchClientFactory .createSearchClient ();
139
139
for (int batchIndex = 0 ; batchIndex < sectionBatches .size (); batchIndex ++) {
140
140
List <Section > sectionBatch = sectionBatches .get (batchIndex );
141
141
List <Map <String , Object >> documents = new ArrayList <>();
0 commit comments