I was wondering the same thing. This seems like a Bad Thing,
where will this pop out next? Endless problems for no good
purpose IMO.

In schema.xml:
 <!-- field names should consist of alphanumeric or underscore characters
only and
      not start with a digit.  This is not currently strictly enforced,
      but other field names will not have first class support from all
components
      and back compatibility is not guaranteed.  Names with both leading and
      trailing underscores (e.g. _version_) are reserved.
   -->

-1

FWIW


On Tue, Mar 5, 2013 at 6:11 AM, Erik Hatcher <[email protected]> wrote:

> Ugh though. I thought we were going to be stricter about enforcing field
> names to be 'Java identifier'-like characters only.  Why encourage/support
> # in a field name?  -0
>
>     Erik
>
> On Mar 4, 2013, at 20:03, [email protected] wrote:
>
> > Author: hossman
> > Date: Tue Mar  5 01:03:06 2013
> > New Revision: 1452612
> >
> > URL: http://svn.apache.org/r1452612
> > Log:
> > SOLR-4524: test proving this works
> >
> > Modified:
> >
>  
> lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/ReturnFieldsTest.java
> >
> > Modified:
> lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/ReturnFieldsTest.java
> > URL:
> http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/ReturnFieldsTest.java?rev=1452612&r1=1452611&r2=1452612&view=diff
> >
> ==============================================================================
> > ---
> lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/ReturnFieldsTest.java
> (original)
> > +++
> lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/ReturnFieldsTest.java
> Tue Mar  5 01:03:06 2013
> > @@ -49,9 +49,9 @@ public class ReturnFieldsTest extends So
> >   public static void beforeClass() throws Exception {
> >     initCore("solrconfig.xml", "schema12.xml");
> >     String v = "how now brown cow";
> > -    assertU(adoc("id","1", "text",v,  "text_np", v));
> > +    assertU(adoc("id","1", "text",v,  "text_np", v, "#foo_s", v));
> >     v = "now cow";
> > -    assertU(adoc("id","2", "text",v,  "text_np",v));
> > +    assertU(adoc("id","2", "text",v,  "text_np", v));
> >     assertU(commit());
> >   }
> >
> > @@ -307,6 +307,23 @@ public class ReturnFieldsTest extends So
> >     assertFalse(rf.wantsAllFields());
> >   }
> >
> > +  @Test
> > +  public void testFunkyFieldNames() {
> > +    ReturnFields rf = new SolrReturnFields(req("fl", "#foo_s", "fl",
> "id"));
> > +    assertFalse(rf.wantsScore());
> > +    assertTrue(rf.wantsField("id"));
> > +    assertTrue(rf.wantsField("#foo_s"));
> > +    assertFalse(rf.wantsField("xxx"));
> > +    assertFalse(rf.wantsAllFields());
> > +
> > +    assertQ(req("q","id:1", "fl","#foo_s", "fl","id")
> > +            ,"//*[@numFound='1'] "
> > +            ,"//str[@name='id'][.='1']"
> > +            ,"//arr[@name='#foo_s']/str[.='how now brown cow']"
> > +            );
> > +
> > +  }
> > +
> >   public void testWhitespace() {
> >     Random r = random();
> >     final int iters = atLeast(30);
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to