r863 - in trunk: wikitty-api/src/test/java/org/nuiton/wikitty/api wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr wikitty-solr/src/main/resources
Author: bpoussin Date: 2011-05-06 04:09:38 +0200 (Fri, 06 May 2011) New Revision: 863 Url: http://nuiton.org/repositories/revision/wikitty/863 Log: retour en arriere, tous les champs sont indexes en multivalued, et on ajoute un champs supplementaire _sortable utilise pour trier. Les champs reellement multivalued sont tries par rapport a leur 1er element. Modified: trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/AbstractSearchTest.java trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/AttachmentInTree.java trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/FieldModifier.java trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/Restriction2Solr.java trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/SolrUtil.java trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittyQueryParser.java trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySearchEngineSolr.java trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySolrConstant.java trunk/wikitty-solr/src/main/resources/schema.xml Modified: trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/AbstractSearchTest.java =================================================================== --- trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/AbstractSearchTest.java 2011-05-05 16:08:19 UTC (rev 862) +++ trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/AbstractSearchTest.java 2011-05-06 02:09:38 UTC (rev 863) @@ -45,6 +45,7 @@ import org.nuiton.wikitty.search.operators.Like; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import static org.junit.Assert.assertEquals; @@ -740,6 +741,8 @@ @Test public void testSearchAllLowerCase() { + // FIXME implement it in memory + assumeNotYetImplementedInMemory(); { Criteria criteria = Search.query().eq("Category.name", "HardWare").criteria(); PagedResult<Wikitty> pagedResult = proxy.findAllByCriteria(criteria); @@ -774,12 +777,15 @@ @Test public void testSearchWithSort() { + // FIXME implement it in memory + assumeNotYetImplementedInMemory(); { - Criteria criteria = Search.query().like("name", "*").criteria(); - criteria.setSortAscending(new String[]{"name"}); + Criteria criteria = Search.query().like("*.name", "*").criteria(); + criteria.setSortAscending(new String[]{"*.name"}); try { proxy.findAllByCriteria(criteria); } catch (Exception eee) { + eee.printStackTrace(); Assert.fail(); } } @@ -791,28 +797,31 @@ .extension(); proxy.storeExtension(sortable); + List<Integer> expected = new ArrayList<Integer>(); + expected.add(10); + expected.add(1); + expected.add(7); + //Create wikitty sortable - Wikitty sortable10 = new WikittyImpl(); - sortable10.addExtension(sortable); - sortable10.setField(sortableExtName, numFieldName, 10); + for (Integer i : expected) { + Wikitty w = new WikittyImpl(); + w.addExtension(sortable); + w.setField(sortableExtName, numFieldName, i); + proxy.store(w); - Wikitty sortable1 = new WikittyImpl(); - sortable1.addExtension(sortable); - sortable1.setField(sortableExtName, numFieldName, 1); - - Wikitty sortable7 = new WikittyImpl(); - sortable7.addExtension(sortable); - sortable7.setField(sortableExtName, numFieldName, 7); - - proxy.store(sortable10); - proxy.store(sortable1); - proxy.store(sortable7); + } + Collections.sort(expected); { Criteria criteria = Search.query().eq(Element.ELT_EXTENSION, sortableExtName).criteria(); - criteria.setSortAscending(new String[]{numFieldName}); + criteria.setSortAscending(new String[]{ + WikittyUtil.getFQFieldName(sortableExtName, numFieldName)}); PagedResult<Wikitty> result = proxy.findAllByCriteria(criteria); - int firstNum = result.get(0).getFieldAsInt(sortableExtName, numFieldName); - assertEquals(1, firstNum); + + List<Integer> resulted = new ArrayList<Integer>(); + for (Wikitty w : result) { + resulted.add(w.getFieldAsInt(sortableExtName, numFieldName)); + } + assertEquals(expected, resulted); } } Modified: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/AttachmentInTree.java =================================================================== --- trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/AttachmentInTree.java 2011-05-05 16:08:19 UTC (rev 862) +++ trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/AttachmentInTree.java 2011-05-06 02:09:38 UTC (rev 863) @@ -124,11 +124,11 @@ * @param doc TreeNode document representation */ public void remove(SolrDocument doc) { - String id = (String)doc.getFieldValue(WikittySolrConstant.SOLR_ID); + String id = SolrUtil.getStringFieldValue(doc, WikittySolrConstant.SOLR_ID); - Collection att = doc.getFieldValues(SolrUtil.getSolrFieldName( + Collection<String> att = SolrUtil.getStringFieldValues(doc, WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_ATTACHMENT, - TYPE.WIKITTY)); + TYPE.WIKITTY); remove(id, att); } @@ -136,11 +136,11 @@ * @param doc TreeNode document representation */ public void remove(SolrInputDocument doc) { - String id = (String)doc.getFieldValue(WikittySolrConstant.SOLR_ID); + String id = SolrUtil.getStringFieldValue(doc, WikittySolrConstant.SOLR_ID); - Collection att = doc.getFieldValues(SolrUtil.getSolrFieldName( + Collection<String> att = SolrUtil.getStringFieldValues(doc, WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_ATTACHMENT, - TYPE.WIKITTY)); + TYPE.WIKITTY); remove(id, att); } @@ -176,11 +176,11 @@ * @param doc TreeNode document representation */ public void add(SolrDocument doc) { - String id = (String)doc.getFieldValue(WikittySolrConstant.SOLR_ID); + String id = SolrUtil.getStringFieldValue(doc, WikittySolrConstant.SOLR_ID); - Collection att = doc.getFieldValues(SolrUtil.getSolrFieldName( + Collection<String> att = SolrUtil.getStringFieldValues(doc, WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_ATTACHMENT, - TYPE.WIKITTY)); + TYPE.WIKITTY); add(id, att); } @@ -193,15 +193,15 @@ * @since 3.0.5 */ public void add(SolrDocument doc, Set<String> restriction) { - String id = (String)doc.getFieldValue(WikittySolrConstant.SOLR_ID); + String id = SolrUtil.getStringFieldValue(doc, WikittySolrConstant.SOLR_ID); - Collection att = doc.getFieldValues(SolrUtil.getSolrFieldName( + Collection<String> att = SolrUtil.getStringFieldValues(doc, WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_ATTACHMENT, - TYPE.WIKITTY)); + TYPE.WIKITTY); if (att != null) { - for (Object attId : att) { + for (String attId : att) { if (restriction.contains(attId)) { - add(id, (String)attId); + add(id, attId); } } } @@ -212,11 +212,11 @@ * @param doc TreeNode document representation */ public void add(SolrInputDocument doc) { - String id = (String)doc.getFieldValue(WikittySolrConstant.SOLR_ID); + String id = SolrUtil.getStringFieldValue(doc, WikittySolrConstant.SOLR_ID); - Collection att = doc.getFieldValues(SolrUtil.getSolrFieldName( + Collection<String> att = SolrUtil.getStringFieldValues(doc, WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_ATTACHMENT, - TYPE.WIKITTY)); + TYPE.WIKITTY); add(id, att); } Modified: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/FieldModifier.java =================================================================== --- trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/FieldModifier.java 2011-05-05 16:08:19 UTC (rev 862) +++ trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/FieldModifier.java 2011-05-06 02:09:38 UTC (rev 863) @@ -35,23 +35,7 @@ import org.nuiton.wikitty.services.WikittyTransaction; import org.nuiton.wikitty.storage.WikittyExtensionStorage; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SOLR_ALL_EXTENSIONS; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SOLR_DEFAULT_FIELD; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SOLR_EXTENSIONS; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SOLR_ID; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SOLR_WIKITTY_PREFIX; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_BINARY; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_BINARY_MULTIVALUED; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_BOOLEAN; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_DATE; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_NUMERIC; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_STRING; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_WIKITTY; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_BOOLEAN_MULTIVALUED; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_DATE_MULTIVALUED; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_NUMERIC_MULTIVALUED; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_STRING_MULTIVALUED; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_WIKITTY_MULTIVALUED; +import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.*; /** * @@ -107,12 +91,17 @@ // utile pour force la recherche sur les bons champs lorsqu'on demande une recherche sur * == #all String fieldNameType = searchField[2]; TYPE type = FieldType.TYPE.valueOf(fieldNameType); - // Ajout du pattern solr pour discriminer le champs ex : _s, _sm, _wm ... - result = SolrUtil.getSolrCollectionFieldName(result, type); + // Ajout du pattern solr pour discriminer le champs ex : _s, _dt, _w, ... +// FIXME REMOVE IT if search on multivalued work with new hack (specific sortable field +// result = SolrUtil.getSolrCollectionFieldName(result, type); + result = SolrUtil.getSolrFieldName(result, type); } else { - log.error("Search on multi extentions (*) without field type, fallback search in fulltext"); - result = SOLR_DEFAULT_FIELD - + WikittyUtil.FQ_FIELD_NAME_SEPARATOR + result; + if (log.isDebugEnabled()) { + log.debug("Search on multi extentions (*) without field" + + " type, fallback search in fulltext"); + } + result = SOLR_FULLTEXT_ALL_EXTENSIONS + + WikittyUtil.FQ_FIELD_NAME_SEPARATOR + fieldName; } } else { result = extName + WikittyUtil.FQ_FIELD_NAME_SEPARATOR + fieldName; @@ -130,11 +119,12 @@ } if (fieldType != null) { // type can be null if extension version differ TYPE type = fieldType.getType(); - if (fieldType.isCollection()) { - result = SolrUtil.getSolrCollectionFieldName(result, type); - } else { +// FIXME REMOVE IT if search on multivalued work with new hack (specific sortable field +// if (fieldType.isCollection()) { +// result = SolrUtil.getSolrCollectionFieldName(result, type); +// } else { result = SolrUtil.getSolrFieldName(result, type); - } +// } } } } @@ -151,12 +141,15 @@ + "|(" + SUFFIX_STRING + "$)" + "|(" + SUFFIX_WIKITTY + "$)" + "|(" + SUFFIX_NUMERIC + "$)" - + "|(" + SUFFIX_BINARY_MULTIVALUED + "$)" - + "|(" + SUFFIX_BOOLEAN_MULTIVALUED + "$)" - + "|(" + SUFFIX_DATE_MULTIVALUED + "$)" - + "|(" + SUFFIX_STRING_MULTIVALUED + "$)" - + "|(" + SUFFIX_WIKITTY_MULTIVALUED + "$)" - + "|(" + SUFFIX_NUMERIC_MULTIVALUED + "$)", ""); +// FIXME REMOVE IT if search on multivalued work with new hack (specific sortable field +// + "|(" + SUFFIX_BINARY_MULTIVALUED + "$)" +// + "|(" + SUFFIX_BOOLEAN_MULTIVALUED + "$)" +// + "|(" + SUFFIX_DATE_MULTIVALUED + "$)" +// + "|(" + SUFFIX_STRING_MULTIVALUED + "$)" +// + "|(" + SUFFIX_WIKITTY_MULTIVALUED + "$)" +// + "|(" + SUFFIX_NUMERIC_MULTIVALUED + "$)" + + "|(" + SUFFIX_SORTABLE + "$)" + , ""); if (SOLR_EXTENSIONS.equals(fieldName)) { fieldName = Element.ELT_EXTENSION; } Modified: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/Restriction2Solr.java =================================================================== --- trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/Restriction2Solr.java 2011-05-05 16:08:19 UTC (rev 862) +++ trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/Restriction2Solr.java 2011-05-06 02:09:38 UTC (rev 863) @@ -193,7 +193,8 @@ try { resp = SolrUtil.executeQuery(solr, query); } catch (SolrServerException e) { - throw new WikittyException("Unable to execute associative query on " + associated.getElement().getName(), e); + throw new WikittyException("Unable to execute associative query on " + + associated.getElement().getName(), e); } SolrDocumentList solrResults = resp.getResults(); @@ -202,12 +203,13 @@ if ( size == 0 ) { generatedRestriction = RestrictionHelper.rFalse(); } else if ( size == 1 ) { - generatedRestriction = RestrictionHelper.eq( associated.getElement(), - (String) solrResults.get(0).getFieldValue(WikittySolrConstant.SOLR_ID) ); + String id = SolrUtil.getStringFieldValue( + solrResults.get(0), WikittySolrConstant.SOLR_ID); + generatedRestriction = RestrictionHelper.eq(associated.getElement(), id); } else { List<String> ids = new ArrayList<String>(solrResults.size()); for (SolrDocument doc : solrResults) { - String id = (String) doc.getFieldValue(WikittySolrConstant.SOLR_ID); + String id = SolrUtil.getStringFieldValue(doc, WikittySolrConstant.SOLR_ID); ids.add(id); } generatedRestriction = new In(associated.getElement(), ids); @@ -408,18 +410,20 @@ element2solr += WikittySolrConstant.SUFFIX_STRING_LOWERCASE; break; } - } else if (element2solr.endsWith(WikittySolrConstant.SUFFIX_STRING_MULTIVALUED)) { // is multivalued string - // Remove _s*m* - element2solr = element2solr.substring(0, element2solr.length() - 1); - switch (searchAs) { - case AsText: - element2solr += WikittySolrConstant.SUFFIX_STRING_FULLTEXT_MULTIVALUED; - break; - case ToLowerCase: - element2solr += WikittySolrConstant.SUFFIX_STRING_FULLTEXT_LOWERCASE; - break; - } } +// FIXME REMOVE IT if search on multivalued work with new hack (specific sortable field +// else if (element2solr.endsWith(WikittySolrConstant.SUFFIX_STRING_MULTIVALUED)) { // is multivalued string +// // Remove _s*m* +// element2solr = element2solr.substring(0, element2solr.length() - 1); +// switch (searchAs) { +// case AsText: +// element2solr += WikittySolrConstant.SUFFIX_STRING_FULLTEXT_MULTIVALUED; +// break; +// case ToLowerCase: +// element2solr += WikittySolrConstant.SUFFIX_STRING_FULLTEXT_LOWERCASE; +// break; +// } +// } // Warning if you need add searchAs, AsText and ToLowerCase need search // at lowercase String value2solr = value2solr(like.getValue()); Modified: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/SolrUtil.java =================================================================== --- trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/SolrUtil.java 2011-05-05 16:08:19 UTC (rev 862) +++ trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/SolrUtil.java 2011-05-06 02:09:38 UTC (rev 863) @@ -42,15 +42,17 @@ import java.util.Map; import java.util.Set; import org.nuiton.util.TimeLog; +import org.nuiton.wikitty.entities.FieldType; import org.nuiton.wikitty.entities.WikittyTreeNode; import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SOLR_ID; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_BINARY_MULTIVALUED; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_BOOLEAN_MULTIVALUED; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_DATE_MULTIVALUED; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_NUMERIC_MULTIVALUED; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_STRING_MULTIVALUED; -import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_WIKITTY_MULTIVALUED; +// FIXME REMOVE IT if search on multivalued work with new hack (specific sortable field +//import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_BINARY_MULTIVALUED; +//import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_BOOLEAN_MULTIVALUED; +//import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_DATE_MULTIVALUED; +//import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_NUMERIC_MULTIVALUED; +//import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_STRING_MULTIVALUED; +//import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_WIKITTY_MULTIVALUED; import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.TREENODE_PARENTS; import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.TREENODE_ATTACHED; import static org.nuiton.wikitty.storage.solr.WikittySolrConstant.SUFFIX_BINARY; @@ -192,7 +194,7 @@ SolrDocumentList results = response.getResults(); for (SolrDocument doc : results) { - String id = (String) doc.getFieldValue(SOLR_ID); + String id = getStringFieldValue(doc, SOLR_ID); result.put(id, doc); } } catch (SolrServerException eee) { @@ -238,51 +240,61 @@ * @return field name */ static public String getSolrFieldName(String fqfieldName, TYPE type) { - switch (type) { - case BINARY: - return fqfieldName + SUFFIX_BINARY; - case BOOLEAN: - return fqfieldName + SUFFIX_BOOLEAN; - case DATE: - return fqfieldName + SUFFIX_DATE; - case STRING: - return fqfieldName + SUFFIX_STRING; - case NUMERIC: - return fqfieldName + SUFFIX_NUMERIC; - case WIKITTY: - return fqfieldName + SUFFIX_WIKITTY; - default: - return fqfieldName; + String result = fqfieldName; + if (type != null) { + switch (type) { + case BINARY: + result = fqfieldName + SUFFIX_BINARY; + break; + case BOOLEAN: + result = fqfieldName + SUFFIX_BOOLEAN; + break; + case DATE: + result = fqfieldName + SUFFIX_DATE; + break; + case STRING: + result = fqfieldName + SUFFIX_STRING; + break; + case NUMERIC: + result = fqfieldName + SUFFIX_NUMERIC; + break; + case WIKITTY: + result = fqfieldName + SUFFIX_WIKITTY; + break; + default: + result = fqfieldName; + } } + return result; } - /** - * if you change this method, change - * {@link FieldModifier#convertToField(org.nuiton.wikitty.services.WikittyTransaction, java.lang.String)} - * too - * - * @param fqfieldName FQ field name - * @param type of field - * @return field name - */ - static public String getSolrCollectionFieldName(String fqfieldName, TYPE type) { - switch (type) { - case BINARY: - return fqfieldName + SUFFIX_BINARY_MULTIVALUED; - case BOOLEAN: - return fqfieldName + SUFFIX_BOOLEAN_MULTIVALUED; - case DATE: - return fqfieldName + SUFFIX_DATE_MULTIVALUED; - case STRING: - return fqfieldName + SUFFIX_STRING_MULTIVALUED; - case NUMERIC: - return fqfieldName + SUFFIX_NUMERIC_MULTIVALUED; - case WIKITTY: - return fqfieldName + SUFFIX_WIKITTY_MULTIVALUED; - default: - return fqfieldName; - } - } +// /** +// * if you change this method, change +// * {@link FieldModifier#convertToField(org.nuiton.wikitty.services.WikittyTransaction, java.lang.String)} +// * too +// * +// * @param fqfieldName FQ field name +// * @param type of field +// * @return field name +// */ +// static public String getSolrCollectionFieldName(String fqfieldName, TYPE type) { +// switch (type) { +// case BINARY: +// return fqfieldName + SUFFIX_BINARY_MULTIVALUED; +// case BOOLEAN: +// return fqfieldName + SUFFIX_BOOLEAN_MULTIVALUED; +// case DATE: +// return fqfieldName + SUFFIX_DATE_MULTIVALUED; +// case STRING: +// return fqfieldName + SUFFIX_STRING_MULTIVALUED; +// case NUMERIC: +// return fqfieldName + SUFFIX_NUMERIC_MULTIVALUED; +// case WIKITTY: +// return fqfieldName + SUFFIX_WIKITTY_MULTIVALUED; +// default: +// return fqfieldName; +// } +// } /** * Copy solr document @@ -363,7 +375,236 @@ copySolrDocument(source, dest, null, fieldToExclude); } + static public Collection<String> getStringFieldValues (SolrDocument d, String fieldname) { + Collection<String> result = getStringFieldValues(d, fieldname, null); + return result; + } + + static public Collection<String> getStringFieldValues (SolrInputDocument d, String fieldname) { + Collection<String> result = getStringFieldValues(d, fieldname, null); + return result; + } + + static public Collection<String> getStringFieldValues ( + SolrDocument d, String fieldname, FieldType.TYPE type) { + // petit hack, car la methode retourne un Collection<Object> alors + // qu'il sagit en fait d'un Collection<String>, de cette facon on force + // la conversion en passant par une colleciton non typee + String solrFieldName = SolrUtil.getSolrFieldName(fieldname, type); + Collection tmp = d.getFieldValues(solrFieldName); + Collection<String> result = (Collection<String>)tmp; + return result; + } + + static public Collection<String> getStringFieldValues ( + SolrInputDocument d, String fieldname, FieldType.TYPE type) { + // petit hack, car la methode retourne un Collection<Object> alors + // qu'il sagit en fait d'un Collection<String>, de cette facon on force + // la conversion en passant par une colleciton non typee + String solrFieldName = SolrUtil.getSolrFieldName(fieldname, type); + Collection tmp = d.getFieldValues(solrFieldName); + Collection<String> result = (Collection<String>)tmp; + return result; + } + /** + * get value of field in SolrDocument, field must have only one value + * @param d + * @param fieldname + * @param type + * @return + */ + static public String getStringFieldValue(SolrInputDocument d, String fieldname) { + String result = getStringFieldValue(d, fieldname, null); + return result; + } + + /** + * get value of field in SolrDocument, field must have only one value + * @param d + * @param fieldname + * @param type optional type to generate solr field name + * @return + */ + static public String getStringFieldValue( + SolrInputDocument d, String fieldname, FieldType.TYPE type) { + String solrFieldName = SolrUtil.getSolrFieldName(fieldname, type); + + Object value = d.getFieldValue(solrFieldName); + String result = convertToString(value, solrFieldName); + return result; + } + + /** + * get value of field in SolrDocument, field must have only one value + * @param d + * @param fieldname + * @param type + * @return + */ + static public String getStringFieldValue(SolrDocument d, String fieldname) { + String result = getStringFieldValue(d, fieldname, null); + return result; + } + + /** + * get value of field in SolrDocument, field must have only one value + * @param d + * @param fieldname + * @param type optional type to generate solr field name + * @return + */ + static public String getStringFieldValue(SolrDocument d, String fieldname, FieldType.TYPE type) { + String solrFieldName = SolrUtil.getSolrFieldName(fieldname, type); + + Object value = d.getFieldValue(solrFieldName); + String result = convertToString(value, solrFieldName); + return result; + } + + /** + * get value of field in SolrDocument, field must have only one value + * @param d + * @param fieldname + * @param type + * @return + */ + static public Integer getIntFieldValue(SolrDocument d, String fieldname) { + Integer result = getIntFieldValue(d, fieldname, null); + return result; + } + + /** + * get value of field in SolrDocument, field must have only one value + * @param d + * @param fieldname + * @param type optional type to generate solr field name + * @return + */ + static public Integer getIntFieldValue(SolrDocument d, String fieldname, FieldType.TYPE type) { + String solrFieldName = SolrUtil.getSolrFieldName(fieldname, type); + + Object value = d.getFieldValue(solrFieldName); + Integer result = convertToInteger(value, solrFieldName); + return result; + } + + /** + * Converti un Object en String, si l'objet est de type String un simple + * cast est fait, si l'objet est un tableau, on prend le 1er element, si + * le tableau contient plus de 1 element une exception est levee + * + * @param value + * @return une string ou null si value est null ou est un tableau vide + */ + static public String convertToString(Object value, String solrFieldName) { + String result; + if (value == null) { + result = null; + } else if (value instanceof String) { + // c'est un champs monovalue + result = (String)value; + } else if (value instanceof String[]) { + // c'est un champs multivalue + String[] values = (String[])value; + if (values.length == 0) { + result = null; + } else if (values.length == 1) { + result = values[0]; + } else { + throw new WikittyException(String.format( + "You can't get one value from field (%s) with many (%s) value", + solrFieldName, values.length)); + } + } else if (value instanceof Collection) { + Collection c = (Collection)value; + if (c.isEmpty()) { + result = null; + } else if (c.size() == 1){ + Object o = c.iterator().next(); + result = convertToString(o, solrFieldName); + } else { + throw new WikittyException(String.format( + "You can't get one value from field (%s) with many (%s) value", + solrFieldName, c.size())); + } + } else { + throw new WikittyException(String.format( + "Field (%s) is not an String but %s", + solrFieldName, value.getClass().getName())); + } + return result; + } + + /** + * Converti un Object en String, si l'objet est de type String un simple + * cast est fait, si l'objet est un tableau, on prend le 1er element, si + * le tableau contient plus de 1 element une exception est levee + * + * @param value + * @return une string ou null si value est null ou est un tableau vide + */ + static public Integer convertToInteger(Object value, String solrFieldName) { + Integer result; + if (value == null) { + result = null; + } else if (value instanceof Integer) { + // c'est un champs monovalue + result = (Integer)value; + } else if (value instanceof Integer[]){ + // c'est un champs multivalue + Integer[] values = (Integer[])value; + if (values.length == 0) { + result = null; + } else if (values.length == 1) { + result = values[0]; + } else { + throw new WikittyException(String.format( + "You can't get one value from field (%s) with many (%s) value", + solrFieldName, values.length)); + } + } else { + throw new WikittyException(String.format( + "Field (%s) is not an Integer but %s", + solrFieldName, value.getClass().getName())); + } + return result; + } + + /** + * If value is collection or array get only the first element, else + * juste return value. + * + * @param o + * @return + */ + static public Object getOneValue(Object value) { + Object result; + if (value == null) { + result = null; + } else if (value instanceof Object[]) { + // c'est un champs multivalue + Object[] values = (Object[])value; + if (values.length == 0) { + result = null; + } else { + result = values[0]; + } + } else if (value instanceof Collection) { + Collection c = (Collection)value; + if (c.isEmpty()) { + result = null; + } else { + Object o = c.iterator().next(); + result = getOneValue(o); + } + } else { + result = value; + } + return result; + } + + /** * Quote s for solr. Currently only ':' is escaped * @param s to quote * @return new string solr compliant Modified: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittyQueryParser.java =================================================================== --- trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittyQueryParser.java 2011-05-05 16:08:19 UTC (rev 862) +++ trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittyQueryParser.java 2011-05-06 02:09:38 UTC (rev 863) @@ -76,7 +76,7 @@ // valeur dans la config. Mais en fait a chaque fois on passe // ici car defaultField est null :( alors que dans schema.xml // on a bien defini le defaultField :( - defaultField = WikittySolrConstant.SOLR_DEFAULT_FIELD; + defaultField = WikittySolrConstant.SOLR_FULLTEXT; } lparser = new SolrQueryParser(this, defaultField); Modified: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySearchEngineSolr.java =================================================================== --- trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySearchEngineSolr.java 2011-05-05 16:08:19 UTC (rev 862) +++ trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySearchEngineSolr.java 2011-05-06 02:09:38 UTC (rev 863) @@ -239,9 +239,11 @@ // pour les autres les attachments seront traites dans // la phase suivante Set<String> newAtt = WikittyTreeNodeHelper.getAttachment(w); - Collection oldAtt = oldDoc.getFieldValues(SolrUtil.getSolrFieldName( + + Collection<String> oldAtt = SolrUtil.getStringFieldValues( + oldDoc, WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_ATTACHMENT, - TYPE.WIKITTY)); + TYPE.WIKITTY); // il faut supprimer l'indexation arbre des noeuds // qui sont dans old, mais pas dans new Set<String> toRemove = new HashSet<String>(); @@ -410,7 +412,7 @@ WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_ATTACHMENT, TYPE.WIKITTY); SolrUtil.copySolrDocumentExcludeSomeField(doc, newDoc, field); - Collection atts = doc.getFieldValues(field); + Collection<String> atts = SolrUtil.getStringFieldValues(doc, field); // remove deleted attachment Set<String> newAtts = new HashSet<String>(atts); newAtts.removeAll(ids); @@ -491,7 +493,7 @@ SolrInputDocument doc, Map<String, SolrDocument> tree) { Set<String> parents = new HashSet<String>(); String root = null; - String treeNodeId = (String)doc.getFieldValue(SOLR_ID); + String treeNodeId = SolrUtil.getStringFieldValue(doc, WikittySolrConstant.SOLR_ID); String parentId = treeNodeId; if (parentId == null) { throw new WikittyException("parentId is null, but this must be impossible"); @@ -504,13 +506,14 @@ // si parentDoc a deja ete indexe pour l'arbre, on peut reutiliser // directement les valeurs et sortir de la boucle if (parentDoc.containsKey(TREENODE_ROOT)) { - root = (String) parentDoc.getFieldValue(TREENODE_ROOT); - Collection p = parentDoc.getFieldValues(TREENODE_PARENTS); + root = SolrUtil.getStringFieldValue(parentDoc, TREENODE_ROOT); + Collection<String> p = SolrUtil.getStringFieldValues(parentDoc, TREENODE_PARENTS); parents.addAll(p); break; } else { - nextParentId = (String) parentDoc.getFieldValue(SolrUtil.getSolrFieldName( - WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_PARENT, TYPE.WIKITTY)); + nextParentId = SolrUtil.getStringFieldValue(parentDoc, + WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_PARENT, + TYPE.WIKITTY); } } else { SolrDocument oldParentDoc = tree.get(parentId); @@ -518,13 +521,14 @@ // si parentDoc a deja ete indexe pour l'arbre, on peut reutiliser // directement les valeurs et sortir de la boucle if (oldParentDoc.containsKey(TREENODE_ROOT)) { - root = (String) oldParentDoc.getFieldValue(TREENODE_ROOT); - Collection p = oldParentDoc.getFieldValues(TREENODE_PARENTS); + root = SolrUtil.getStringFieldValue(oldParentDoc,TREENODE_ROOT); + Collection<String> p = SolrUtil.getStringFieldValues(oldParentDoc, TREENODE_PARENTS); parents.addAll(p); break; } else { - nextParentId = (String) oldParentDoc.getFieldValue(SolrUtil.getSolrFieldName( - WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_PARENT, TYPE.WIKITTY)); + nextParentId = SolrUtil.getStringFieldValue(oldParentDoc, + WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_PARENT, + TYPE.WIKITTY); } } } @@ -585,13 +589,15 @@ } } for (String treeNodeId : attachmentInTree.getAdded().keySet()) { - Collection treeNodeParents = null; + Collection<String> treeNodeParents = null; SolrInputDocument treeNodeDoc = solrResource.getAddedDoc(treeNodeId); if (treeNodeDoc != null) { - treeNodeParents = treeNodeDoc.getFieldValues(TREENODE_PARENTS); + treeNodeParents = SolrUtil.getStringFieldValues( + treeNodeDoc, TREENODE_PARENTS); } else if (tree != null) { SolrDocument doc = tree.get(treeNodeId); - treeNodeParents = doc.getFieldValues(TREENODE_PARENTS); + treeNodeParents = SolrUtil.getStringFieldValues( + doc, TREENODE_PARENTS); } else { log.error("SolR doc not found in Transaction or in tree." + "This is a bug !!!"); @@ -658,6 +664,7 @@ if(sortAscending != null) { for (String sort : sortAscending) { String tranform = fieldModifier.convertToSolr(transaction, sort); + tranform += WikittySolrConstant.SUFFIX_SORTABLE; query.addSortField(tranform, SolrQuery.ORDER.asc); } } @@ -666,6 +673,7 @@ if(sortDescending != null) { for (String sort : sortDescending) { String tranform = fieldModifier.convertToSolr(transaction, sort); + tranform += WikittySolrConstant.SUFFIX_SORTABLE; query.addSortField(tranform, SolrQuery.ORDER.desc); } } @@ -738,7 +746,7 @@ List<String> ids = new ArrayList<String>(solrResults.size()); for (SolrDocument doc : solrResults) { - String id = (String) doc.getFieldValue(SOLR_ID); + String id = SolrUtil.getStringFieldValue(doc, SOLR_ID); ids.add(id); } @@ -778,7 +786,7 @@ Search treeSearch = Search.query().and().eq(TREENODE_PARENTS, wikittyId); if (depth >= 0) { - Integer d = (Integer) doc.getFieldValue(TREENODE_DEPTH); + Integer d = SolrUtil.getIntFieldValue(doc, TREENODE_DEPTH); treeSearch = treeSearch.bw(TREENODE_DEPTH, String.valueOf(d), String.valueOf(d + depth)); @@ -827,11 +835,11 @@ // construction de tous les TreeNodeResult qui permettront // de construire l'arbre for (SolrDocument d : solrResults) { - String id = (String) d.getFieldValue(SOLR_ID); + String id = SolrUtil.getStringFieldValue(d, SOLR_ID); - String parentId = (String) d.getFieldValue(SolrUtil.getSolrFieldName( + String parentId = SolrUtil.getStringFieldValue(d, WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_PARENT, - TYPE.WIKITTY)); + TYPE.WIKITTY); int nb = counts.containsKey(id) ? counts.get(id) : 0; TreeNodeResult<String> child = new TreeNodeResult<String>(id, nb); allTreeNodeResult.put(id, child); @@ -863,6 +871,9 @@ } + /** + * Ajoute un champs dans un document a indexer + */ protected void addToIndexDocument(SolrInputDocument doc, TYPE type, String fqfieldName, Object fieldValue, boolean collection) { @@ -872,31 +883,48 @@ } else { String solrFqFieldName; - if (collection) { - solrFqFieldName = SolrUtil.getSolrCollectionFieldName(fqfieldName, type); - } else { - solrFqFieldName = SolrUtil.getSolrFieldName(fqfieldName, type); - } +// FIXME REMOVE IT if search on multivalued work with new hack (specific sortable field +// if (collection) { +// solrFqFieldName = SolrUtil.getSolrCollectionFieldName(fqfieldName, type); +// } else { + // add suffix like _s for string type ex: myExt.myField_s + solrFqFieldName = SolrUtil.getSolrFieldName(fqfieldName, type); +// } // #all.<fieldname> // permet de faire des recherches inter extension sur un champs ayant // le meme nom. ex:Person.name et User.name // Quoi qu'il arrive pour le #all on utilise du multivalue - String solrAllFqFieldName = SolrUtil.getSolrCollectionFieldName(fqfieldName, type); +// FIXME REMOVE IT if search on multivalued work with new hack (specific sortable field +// String solrAllFqFieldName = SolrUtil.getSolrCollectionFieldName(fqfieldName, type); String solrAllFieldName = SOLR_ALL_EXTENSIONS + WikittyUtil.FQ_FIELD_NAME_SEPARATOR - + WikittyUtil.getFieldNameFromFQFieldName(solrAllFqFieldName); + + WikittyUtil.getFieldNameFromFQFieldName(solrFqFieldName); + // idem mais un champs sur plusieurs extension peut avoir des types + // different, on ajoute donc un champs pour la recherche fulltext + String solrFulltextAllFieldName = SOLR_FULLTEXT_ALL_EXTENSIONS + + WikittyUtil.FQ_FIELD_NAME_SEPARATOR + + WikittyUtil.getFieldNameFromFQFieldName(fqfieldName); + String solrNullFieldFqFieldName = SOLR_NULL_FIELD + fqfieldName; - doc.remove(solrFqFieldName); - doc.remove(solrNullFieldFqFieldName); - doc.remove(solrAllFieldName); + // sortable solr field name for this field ex: myExt.myField_s_sortable + String solrFqFieldNameSortable = solrFqFieldName + SUFFIX_SORTABLE; + doc.remove(solrFqFieldName); // myExt.myField_s + doc.remove(solrNullFieldFqFieldName); // #null_field-myExt.myField + doc.remove(solrAllFieldName); // #all.myField_s + doc.remove(solrFulltextAllFieldName); // #fulltext.all.myField + doc.remove(solrFqFieldNameSortable); // myExt.myField_s_sortable + String solrNullFieldFqFieldNameValue = "true"; if(fieldValue != null) { doc.addField(solrFqFieldName, fieldValue); doc.addField(solrAllFieldName, fieldValue); + doc.addField(solrFulltextAllFieldName, fieldValue); + Object oneFieldValue = SolrUtil.getOneValue(fieldValue); + doc.addField(solrFqFieldNameSortable, oneFieldValue); solrNullFieldFqFieldNameValue = "false"; if (log.isTraceEnabled()) { log.trace(String.format("index field '%s' with value '%s'", Modified: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySolrConstant.java =================================================================== --- trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySolrConstant.java 2011-05-05 16:08:19 UTC (rev 862) +++ trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittySolrConstant.java 2011-05-06 02:09:38 UTC (rev 863) @@ -39,6 +39,9 @@ */ public class WikittySolrConstant { + /** Precise the query parser to use, is allow leading wildcard */ + static final public String SOLR_QUERY_PARSER = "{!wikitty}"; + /** * Prefix utiliser pour les champs ajouter lors de l'indexation. Ce prefix * evite d'avoir des conflits entre un nom d'extension et un champs ajoute @@ -49,21 +52,20 @@ static final public String SOLR_ID = SOLR_WIKITTY_PREFIX + "id"; /** if field is null, this extra field is set to true otherwize is set to false */ - static final public String SOLR_NULL_FIELD = - SOLR_WIKITTY_PREFIX + "null_field-"; + static final public String SOLR_NULL_FIELD = SOLR_WIKITTY_PREFIX + "null_field-"; /** extensions field name in solr */ static final public String SOLR_EXTENSIONS = SOLR_WIKITTY_PREFIX + "extensions"; - /** extension use to store field without extension to search on all extesnion */ + /** default field to fulltext search */ + static final public String SOLR_FULLTEXT = SOLR_WIKITTY_PREFIX + "fulltext"; + + /** extension use to store field without extension to search on all extension */ static final public String SOLR_ALL_EXTENSIONS = SOLR_WIKITTY_PREFIX + "all"; - /** default field to fulltext search */ - static final public String SOLR_DEFAULT_FIELD = SOLR_WIKITTY_PREFIX + "fulltext"; + /** extension use to store field without extension to search on all extension in fulltext mode*/ + static final public String SOLR_FULLTEXT_ALL_EXTENSIONS = SOLR_WIKITTY_PREFIX + "ft.all"; - /** Precise the query parser to use, is allow leading wildcard */ - static final public String SOLR_QUERY_PARSER = "{!wikitty}"; - /** Use for indexation tree node */ static final public String TREENODE_PREFIX = SOLR_WIKITTY_PREFIX + "tree."; /** Use as field on TreeNode */ @@ -85,16 +87,20 @@ static final public String SUFFIX_STRING = "_s"; static final public String SUFFIX_WIKITTY = "_w"; - static final public String SUFFIX_BINARY_MULTIVALUED = "_bim"; - static final public String SUFFIX_BOOLEAN_MULTIVALUED = "_bm"; - static final public String SUFFIX_NUMERIC_MULTIVALUED = "_dm"; - static final public String SUFFIX_DATE_MULTIVALUED = "_dtm"; - static final public String SUFFIX_STRING_MULTIVALUED = "_sm"; - static final public String SUFFIX_WIKITTY_MULTIVALUED = "_wm"; + static final public String SUFFIX_SORTABLE = "_sortable"; +// FIXME REMOVE IT if search on multivalued work with new hack (specific sortable field +// static final public String SUFFIX_BINARY_MULTIVALUED = "_bim"; +// static final public String SUFFIX_BOOLEAN_MULTIVALUED = "_bm"; +// static final public String SUFFIX_NUMERIC_MULTIVALUED = "_dm"; +// static final public String SUFFIX_DATE_MULTIVALUED = "_dtm"; +// static final public String SUFFIX_STRING_MULTIVALUED = "_sm"; +// static final public String SUFFIX_WIKITTY_MULTIVALUED = "_wm"; + static final public String SUFFIX_STRING_LOWERCASE = "_c"; static final public String SUFFIX_STRING_FULLTEXT = "_t"; - public static final String SUFFIX_STRING_FULLTEXT_LOWERCASE = "_cm"; - public static final String SUFFIX_STRING_FULLTEXT_MULTIVALUED = "_tm"; +// FIXME REMOVE IT if search on multivalued work with new hack (specific sortable field +// public static final String SUFFIX_STRING_FULLTEXT_LOWERCASE = "_cm"; +// public static final String SUFFIX_STRING_FULLTEXT_MULTIVALUED = "_tm"; } Modified: trunk/wikitty-solr/src/main/resources/schema.xml =================================================================== --- trunk/wikitty-solr/src/main/resources/schema.xml 2011-05-05 16:08:19 UTC (rev 862) +++ trunk/wikitty-solr/src/main/resources/schema.xml 2011-05-06 02:09:38 UTC (rev 863) @@ -162,8 +162,11 @@ <fields> - <!-- WARNING ALL DATA MUST BE STORED, WE MUST BE ABLE TO REINDEX WIKITTY WITH - INDEXED BECAUSE OF HIERARCHICAL FACET, THERE ARE COPY OF DOCUMENT --> + <!-- + | WARNING ALL DATA MUST BE STORED (except copied fields), WE MUST BE ABLE + | TO REINDEX WIKITTY WITH INDEXED BECAUSE OF HIERARCHICAL FACET, THERE + | ARE COPY OF DOCUMENT + +--> <field name="#id" type="string" required="true" indexed="true" stored="true" multiValued="false"/> <field name="#extensions" type="string" indexed="true" stored="true" multiValued="true"/> @@ -171,35 +174,42 @@ <field name="#tree.parents" type="string" indexed="true" stored="true" multiValued="true"/> <field name="#tree.depth" type="int" indexed="true" stored="true" multiValued="false"/> <field name="#tree.attached-all" type="string" indexed="true" stored="false" multiValued="true"/> - <dynamicfield name="#tree.attached.*" type="string" indexed="true" stored="true" multiValued="true"/> - <dynamicfield name="#null_field-*" type="boolean" indexed="true" stored="true" multiValued="false"/> - <!-- copy all field (except binary) in '#fulltext' field for fulltext search --> <field name="#fulltext" type="text" indexed="true" stored="false" multiValued="true"/> - <dynamicField name="#fulltext.*" type="text" indexed="true" stored="false" multiValued="true"/> - <!-- copied field not stored --> - <dynamicField name="*_s_c" type="string_lc" indexed="true" stored="false" multiValued="false"/> - <dynamicField name="*_s_t" type="text" indexed="true" stored="false" multiValued="false"/> - <dynamicField name="*_s_cm" type="string_lc" indexed="true" stored="false" multiValued="true"/> - <dynamicField name="*_s_tm" type="text" indexed="true" stored="false" multiValued="true"/> + <!-- to prevent error if we try to sort on no sortable field (multivalued) + ATTENTION: solr ne prend pas l'ordre de definition, mais tri sur la longueur du + nom des champs dynamique. Donc il faut que _sortable soit plus long que #ft_all --> + <dynamicField name="*_sortable" type="string" indexed="true" stored="false" multiValued="false"/> + + <dynamicField name="#tree.attached.*" type="string" indexed="true" stored="true" multiValued="true"/> + <dynamicField name="#null_field-*" type="boolean" indexed="true" stored="true" multiValued="false"/> + + <!-- pour tous les champs on les indexes aussi en fulltext --> + <dynamicField name="#ft.all.*" type="text" indexed="true" stored="false" multiValued="true"/> + + <!-- copied field not stored --> + <dynamicField name="*_s_c" type="string_lc" indexed="true" stored="false" multiValued="true"/> + <dynamicField name="*_s_t" type="text" indexed="true" stored="false" multiValued="true"/> + <!-- on indexe pas les binary field --> - <dynamicField name="*_bi" type="binary" indexed="false" stored="false" multiValued="false"/> - <dynamicField name="*_b" type="boolean" indexed="true" stored="true" multiValued="false"/> - <dynamicField name="*_d" type="numeric" indexed="true" stored="true" multiValued="false"/> - <dynamicField name="*_dt" type="date" indexed="true" stored="true" multiValued="false"/> - <dynamicField name="*_s" type="string" indexed="true" stored="true" multiValued="false"/> - <dynamicField name="*_w" type="wikitty" indexed="true" stored="true" multiValued="false"/> - <dynamicField name="*_bim" type="binary" indexed="false" stored="false" multiValued="true"/> - <dynamicField name="*_bm" type="boolean" indexed="true" stored="true" multiValued="true"/> - <dynamicField name="*_dm" type="numeric" indexed="true" stored="true" multiValued="true"/> - <dynamicField name="*_dtm" type="date" indexed="true" stored="true" multiValued="true"/> - <dynamicField name="*_sm" type="string" indexed="true" stored="true" multiValued="true"/> - <dynamicField name="*_wm" type="wikitty" indexed="true" stored="true" multiValued="true"/> + <dynamicField name="*_bi" type="binary" indexed="false" stored="false" multiValued="true"/> + <dynamicField name="*_b" type="boolean" indexed="true" stored="true" multiValued="true"/> + <dynamicField name="*_d" type="numeric" indexed="true" stored="true" multiValued="true"/> + <dynamicField name="*_dt" type="date" indexed="true" stored="true" multiValued="true"/> + <dynamicField name="*_s" type="string" indexed="true" stored="true" multiValued="true"/> + <dynamicField name="*_w" type="wikitty" indexed="true" stored="true" multiValued="true"/> + <dynamicField name="*_bi_sortable" type="binary" indexed="false" stored="false" multiValued="false"/> + <dynamicField name="*_b_sortable" type="boolean" indexed="true" stored="true" multiValued="false"/> + <dynamicField name="*_d_sortable" type="numeric" indexed="true" stored="true" multiValued="false"/> + <dynamicField name="*_dt_sortable" type="date" indexed="true" stored="true" multiValued="false"/> + <dynamicField name="*_s_sortable" type="string" indexed="true" stored="true" multiValued="false"/> + <dynamicField name="*_w_sortable" type="wikitty" indexed="true" stored="true" multiValued="false"/> + <!-- all other field, needed if we do query with unregistered extension. No result is returned but is the right behavior --> - <dynamicField name="*" type="string" indexed="true" stored="false" multiValued="true"/> + <dynamicField name="*" type="string" indexed="true" stored="false" multiValued="false"/> </fields> @@ -221,31 +231,18 @@ <copyField source="*_dt" dest="#fulltext"/> <copyField source="*_s" dest="#fulltext"/> <copyField source="*_w" dest="#fulltext"/> - <copyField source="*_bm" dest="#fulltext"/> - <copyField source="*_dm" dest="#fulltext"/> - <copyField source="*_dtm" dest="#fulltext"/> - <copyField source="*_sm" dest="#fulltext"/> - <copyField source="*_wm" dest="#fulltext"/> - <copyField source="*_b" dest="#fulltext.*"/> +<!-- <copyField source="*_b" dest="#fulltext.*"/> <copyField source="*_d" dest="#fulltext.*"/> <copyField source="*_dt" dest="#fulltext.*"/> <copyField source="*_s" dest="#fulltext.*"/> - <copyField source="*_w" dest="#fulltext.*"/> - <copyField source="*_bm" dest="#fulltext.*"/> - <copyField source="*_dm" dest="#fulltext.*"/> - <copyField source="*_dtm" dest="#fulltext.*"/> - <copyField source="*_sm" dest="#fulltext.*"/> - <copyField source="*_wm" dest="#fulltext.*"/> + <copyField source="*_w" dest="#fulltext.*"/>--> +<!-- <copyField source="#all.*" dest="#fulltext.all.*"/>--> + <!-- copy String field for to lower case version --> <copyField source="*_s" dest="*_s_c"/> <!-- copy String field for text indexed format version --> <copyField source="*_s" dest="*_s_t"/> - <!-- copy String field for to lower case version --> - <copyField source="*_sm" dest="*_s_cm"/> - <!-- copy String field for text indexed format version --> - <copyField source="*_sm" dest="*_s_tm"/> - </schema>
participants (1)
-
bpoussin@users.nuiton.org