mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-09-17 14:21:20 +00:00
Merge branch 'feature/SEARCH-2090' of https://git.alfresco.com/search_discovery/insightengine into feature/SEARCH-2090
This commit is contained in:
@@ -1,4 +1,19 @@
|
|||||||
import itertools
|
# Copyright (C) 2020 Alfresco Software Limited.
|
||||||
|
# This file is part of Alfresco
|
||||||
|
#
|
||||||
|
# Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# Alfresco is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
|
# along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
import itertools
|
||||||
|
|
||||||
tokenized = "tokenized"
|
tokenized = "tokenized"
|
||||||
string = "string"
|
string = "string"
|
||||||
|
@@ -63,7 +63,6 @@ import org.alfresco.repo.search.impl.parsers.AlfrescoFunctionEvaluationContext;
|
|||||||
import org.alfresco.repo.search.impl.parsers.FTSParser;
|
import org.alfresco.repo.search.impl.parsers.FTSParser;
|
||||||
import org.alfresco.repo.search.impl.parsers.FTSQueryParser;
|
import org.alfresco.repo.search.impl.parsers.FTSQueryParser;
|
||||||
import org.alfresco.repo.search.impl.querymodel.Constraint;
|
import org.alfresco.repo.search.impl.querymodel.Constraint;
|
||||||
import org.alfresco.repo.search.impl.querymodel.Ordering;
|
|
||||||
import org.alfresco.repo.search.impl.querymodel.QueryModelFactory;
|
import org.alfresco.repo.search.impl.querymodel.QueryModelFactory;
|
||||||
import org.alfresco.repo.search.impl.querymodel.QueryOptions.Connective;
|
import org.alfresco.repo.search.impl.querymodel.QueryOptions.Connective;
|
||||||
import org.alfresco.repo.search.impl.querymodel.impl.lucene.LuceneQueryBuilder;
|
import org.alfresco.repo.search.impl.querymodel.impl.lucene.LuceneQueryBuilder;
|
||||||
@@ -775,7 +774,6 @@ public class AlfrescoSolrDataModel implements QueryConstants
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: make it better
|
|
||||||
private void addHighlightSearchFields( PropertyDefinition propertyDefinition , IndexedField indexedField)
|
private void addHighlightSearchFields( PropertyDefinition propertyDefinition , IndexedField indexedField)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1000,7 +998,6 @@ public class AlfrescoSolrDataModel implements QueryConstants
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getStoredContentField(QName propertyQName)
|
public String getStoredContentField(QName propertyQName)
|
||||||
{
|
{
|
||||||
PropertyDefinition propertyDefinition = getPropertyDefinition(propertyQName);
|
PropertyDefinition propertyDefinition = getPropertyDefinition(propertyQName);
|
||||||
@@ -1030,7 +1027,6 @@ public class AlfrescoSolrDataModel implements QueryConstants
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the field names into which we must copy the source data
|
* Get all the field names into which we must copy the source data
|
||||||
*
|
*
|
||||||
@@ -1592,11 +1588,10 @@ public class AlfrescoSolrDataModel implements QueryConstants
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO refactor this method
|
|
||||||
*
|
*
|
||||||
* return the stored field associated to potentialProperty parameter
|
* return the stored field associated to potentialProperty parameter
|
||||||
*/
|
*/
|
||||||
public String mapStoredProperty(String potentialProperty, FieldUse fieldUse, SolrQueryRequest req)
|
public String mapStoredProperty(String potentialProperty, SolrQueryRequest req)
|
||||||
{
|
{
|
||||||
if(potentialProperty.equals("asc") || potentialProperty.equals("desc") || potentialProperty.equals("_docid_"))
|
if(potentialProperty.equals("asc") || potentialProperty.equals("desc") || potentialProperty.equals("_docid_"))
|
||||||
{
|
{
|
||||||
@@ -1648,7 +1643,7 @@ public class AlfrescoSolrDataModel implements QueryConstants
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return mapProperty(potentialProperty, fieldUse, req, 0);
|
return mapAlfrescoField(FieldUse.FTS, 0, fieldNameAndEnding, luceneField, propertyDef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1689,6 +1684,12 @@ public class AlfrescoSolrDataModel implements QueryConstants
|
|||||||
propertyDef = getPropertyDefinition(luceneField.substring(index +1));
|
propertyDef = getPropertyDefinition(luceneField.substring(index +1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String solrSortField;
|
||||||
|
solrSortField = mapAlfrescoField(fieldUse, position, fieldNameAndEnding, luceneField, propertyDef);
|
||||||
|
return solrSortField;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String mapAlfrescoField(FieldUse fieldUse, int position, Pair<String, String> fieldNameAndEnding, String luceneField, PropertyDefinition propertyDef) {
|
||||||
String solrSortField;
|
String solrSortField;
|
||||||
if(propertyDef != null)
|
if(propertyDef != null)
|
||||||
{
|
{
|
||||||
|
@@ -2209,7 +2209,7 @@ public class SolrInformationServer implements InformationServer
|
|||||||
|
|
||||||
dataModel.getIndexedFieldNamesForProperty(propertyQName).getFields()
|
dataModel.getIndexedFieldNamesForProperty(propertyQName).getFields()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(field -> field.getField().startsWith("text@sd___@") || field.getField().startsWith("text@m__sort"))
|
.filter(field -> field.getField().startsWith("text@sd___@"))
|
||||||
.forEach(field -> addStringProperty(valueHolder, field, value, locale));
|
.forEach(field -> addStringProperty(valueHolder, field, value, locale));
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package org.alfresco.solr;
|
package org.alfresco.solr;
|
||||||
|
|
||||||
import static java.util.Optional.ofNullable;
|
import static java.util.Optional.ofNullable;
|
||||||
|
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package org.alfresco.solr.component;
|
package org.alfresco.solr.component;
|
||||||
|
|
||||||
import org.alfresco.solr.AlfrescoSolrDataModel;
|
import org.alfresco.solr.AlfrescoSolrDataModel;
|
||||||
@@ -39,8 +57,6 @@ public class RewriteFieldListComponent extends SearchComponent {
|
|||||||
|
|
||||||
private void transformFieldList(SolrQueryRequest req)
|
private void transformFieldList(SolrQueryRequest req)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
Set<String> fieldListSet = new HashSet<>();
|
Set<String> fieldListSet = new HashSet<>();
|
||||||
|
|
||||||
Set<String> defaultNonCachedFields = Set.of("id","DBID", "_version_");
|
Set<String> defaultNonCachedFields = Set.of("id","DBID", "_version_");
|
||||||
@@ -84,15 +100,9 @@ public class RewriteFieldListComponent extends SearchComponent {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<AlfrescoSolrDataModel.FieldUse> fieldUsed = List.of(FTS, FACET, ID, SORT);
|
|
||||||
fieldListSet.addAll(solrReturnFields.getLuceneFieldNames().stream()
|
fieldListSet.addAll(solrReturnFields.getLuceneFieldNames().stream()
|
||||||
.flatMap(field ->
|
.map( field -> AlfrescoSolrDataModel.getInstance()
|
||||||
fieldUsed.stream()
|
.mapStoredProperty(field, req))
|
||||||
.map( fieldUse -> AlfrescoSolrDataModel.getInstance()
|
|
||||||
.mapStoredProperty(field, fieldUse, req)))
|
|
||||||
.filter(schemaFieldName -> schemaFieldName != null)
|
.filter(schemaFieldName -> schemaFieldName != null)
|
||||||
.map(schemaFieldName -> schemaFieldName.chars()
|
.map(schemaFieldName -> schemaFieldName.chars()
|
||||||
.mapToObj(c -> (char) c)
|
.mapToObj(c -> (char) c)
|
||||||
|
Reference in New Issue
Block a user