[ 
https://issues.apache.org/jira/browse/SOLR-10425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15957956#comment-15957956
 ] 

Hoss Man commented on SOLR-10425:
---------------------------------

tomas: i haven't had a change to look at your latest patch, and i have to go 
offline for the rest of the day, but FWIW here's the whitebox test i was 
working on...

{code}
  public void testWhiteboxCreateFields() throws Exception {
    // TODO: add a "coverage" check that all points based dynamic fields in the 
schema are accounted for?
    
    doWhiteboxCreateFields("whitebox_p_i_dv", IntPoint.class, 42, "42");
    doWhiteboxCreateFields("whitebox_p_i_mv", IntPoint.class, 42, "42");
    
    doWhiteboxCreateFields("whitebox_p_i_ni", IntPoint.class, 42, "42");

    // nocommit: TEST ALL THE FIELDS

    
  }
  
  /** nocommit: jdocs, @see callAndCheckCreateFields, verifies same result for 
all values (string or type specific)
   */
  private void doWhiteboxCreateFields(final String fieldName, final Class 
pointType, final Object... values) throws Exception {
    List<IndexableField> firstResult = null;
    for (Object value : values) {
      List<IndexableField> result = callAndCheckCreateFields(fieldName, 
pointType, value);
      assertNotNull(value + " => null", result);
      if (null == firstResult) {
        firstResult = result;
      } else {
        // nocommit: why doesn't this check pass? are some IndexableFields not 
implementing equals?
        // assertEquals(firstResult, result);
      }
    }
  }

  /** nocommit: jdocs, returns the result of createFields after doing some 
sanity checks */
  private List<IndexableField> callAndCheckCreateFields(final String fieldName, 
final Class pointType, final Object value) throws Exception {

    
    final SchemaField sf = h.getCore().getLatestSchema().getField(fieldName);

    final List<IndexableField> results = sf.createFields(value);
    final Set<IndexableField> resultSet = new LinkedHashSet<>(results);
    assertEquals("duplicates found in results? " + results.toString(),
                 results.size(), resultSet.size());

    final Set<Class> resultClasses = new HashSet<>();
    for (IndexableField f : results) {
      resultClasses.add(f.getClass());
      
      if ( ! sf.hasDocValues() ) {
        assertFalse(f.toString(),
                    (f instanceof NumericDocValuesField) ||
                    (f instanceof SortedNumericDocValuesField));
      }
    }

    assertEquals("stored", sf.stored(), 
resultClasses.contains(StoredField.class));
    assertEquals("indexed", sf.indexed(), resultClasses.contains(pointType));
    if (sf.multiValued()) {
      assertEquals("docvalues", sf.hasDocValues(), 
resultClasses.contains(SortedNumericDocValuesField.class));
    } else {
      assertEquals("docvalues", sf.hasDocValues(), 
resultClasses.contains(NumericDocValuesField.class));
    }

    return results;
  }

{code}

> PointFields ignore indexed="false"
> ----------------------------------
>
>                 Key: SOLR-10425
>                 URL: https://issues.apache.org/jira/browse/SOLR-10425
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Hoss Man
>         Attachments: SOLR-10425_hoss.patch, SOLR-10425.patch, 
> SOLR-10425.patch, SOLR-10425.patch
>
>
> (NOTE: description below focuses on {{IntPointField}}, but problem seems to 
> affect all {{PointField}} subclasses)
> There seems to be a disconnect between {{PointField.createFields}} -> 
> {{IntPointField.createField}} -> {{PointField.isFieldUsed}} that results in 
> an {{org.apache.lucene.document.IntPoint}} being created for each field 
> value, even if field is {{indexed="false"}}
> Steps to reproduce...
> {noformat}
> bin/solr -e techproducts
> ...
> curl -X POST -H 'Content-type:application/json' --data-binary '{
>   "add-field":{
>      "name":"hoss_points_check",
>      "type":"pint",
>      "stored":true,
>      "docValues":false,
>      "indexed":false}
> }' http://localhost:8983/solr/techproducts/schema
> ...
> curl -X POST -H 'Content-type:application/json' --data-binary 
> '[{"id":"HOSS","hoss_points_check":42}]' 
> 'http://localhost:8983/solr/techproducts/update/json?commit=true'
> ...
> curl 'http://localhost:8983/solr/techproducts/query?q=id:HOSS'
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":3,
>     "params":{
>       "q":"id:HOSS"}},
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "id":"HOSS",
>         "hoss_points_check":42,
>         "_version_":1563795876337418240}]
>   }}
> curl 'http://localhost:8983/solr/techproducts/query?q=hoss_points_check:42'
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":2,
>     "params":{
>       "q":"hoss_points_check:42"}},
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "id":"HOSS",
>         "hoss_points_check":42,
>         "_version_":1563795876337418240}]
>   }}
> {noformat}
> Note that I can search on the doc using the  "hoss_points_check" field even 
> though it is {{docValues="false" indexed="false"}}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to