Search in sources :

Example 1 with DocumentReferences

use of com.yahoo.searchdefinition.DocumentReferences in project vespa by vespa-engine.

the class SearchOrdererTestCase method createDocumentReference.

private static void createDocumentReference(Search from, Search to, String refFieldName) {
    SDField refField = new TemporarySDField(refFieldName, ReferenceDataType.createWithInferredId(TemporaryStructuredDataType.create(to.getName())));
    SDDocumentType fromDocument = from.getDocument();
    fromDocument.addField(refField);
    Map<String, DocumentReference> originalMap = fromDocument.getDocumentReferences().get().referenceMap();
    HashMap<String, DocumentReference> modifiedMap = new HashMap<>(originalMap);
    modifiedMap.put(refFieldName, new DocumentReference(refField, to));
    fromDocument.setDocumentReferences(new DocumentReferences(modifiedMap));
}
Also used : TemporarySDField(com.yahoo.searchdefinition.document.TemporarySDField) SDField(com.yahoo.searchdefinition.document.SDField) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) HashMap(java.util.HashMap) TemporarySDField(com.yahoo.searchdefinition.document.TemporarySDField) DocumentReference(com.yahoo.searchdefinition.DocumentReference) DocumentReferences(com.yahoo.searchdefinition.DocumentReferences)

Example 2 with DocumentReferences

use of com.yahoo.searchdefinition.DocumentReferences in project vespa by vespa-engine.

the class SearchOrdererTestCase method createSearchDefinition.

private static Search createSearchDefinition(String name, Map<String, Search> searchDefinitions) {
    Search search = new Search(name, null);
    SDDocumentType document = new SDDocumentType(name);
    document.setDocumentReferences(new DocumentReferences(emptyMap()));
    search.addDocument(document);
    searchDefinitions.put(search.getName(), search);
    return search;
}
Also used : SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) Search(com.yahoo.searchdefinition.Search) DocumentReferences(com.yahoo.searchdefinition.DocumentReferences)

Aggregations

DocumentReferences (com.yahoo.searchdefinition.DocumentReferences)2 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)2 DocumentReference (com.yahoo.searchdefinition.DocumentReference)1 Search (com.yahoo.searchdefinition.Search)1 SDField (com.yahoo.searchdefinition.document.SDField)1 TemporarySDField (com.yahoo.searchdefinition.document.TemporarySDField)1 HashMap (java.util.HashMap)1