mardi 20 juillet 2021

Faceting in solr

Good day friends I am facing a problem as I require to match the following query in solr

SELECT entidad, municipio, count(*) as total, 
 sum(case when ip like '10.%' then 1 else 0 end) as internos, 
 sum(case when ip not like '10.%' then 1 else 0 end) as externos 
 FROM bitacora.actividad a 
 where sistema = 'RGNPMarcas' 
 AND fecha >= '2021/07/16' and fecha <= '2021/07/31' 
 AND parametros like 'PDF'
 and parametros like 'EGV'
 and entidad = '01'
 GROUP BY entidad, municipio 
 ORDER BY entidad, municipio

I have been researching on Faceting in solr, I have come to make some counts like the following, but the truth is that I have no idea how to mitigate this situation. enter image description here

My schema is the following:

<field name="tabla" type="string" indexed="true" stored="false" multiValued="false"/>
  <field name="entidad" type="string" indexed="true" stored="true" default="" multiValued="false"/>
  <field name="municipio" type="string" indexed="true" stored="true" default="" multiValued="false"/>
  <field name="ip" type="text_general" indexed="true" stored="true" default="" multiValued="false"/>
  <field name="fecha" type="pdate" indexed="true" stored="true" multiValued="false" default=""/>
  <field name="parametros" type="text_general" indexed="true" stored="true" default="" multiValued="false"/>
  <field name="total" type="pint" uninvertible="true" indexed="true" stored="true"/>
  <field name="internos" type="pint" uninvertible="true" indexed="true" stored="true"/>
  <field name="externos" type="pint" uninvertible="true" indexed="true" stored="true"/>

As you can see, I already have the base and the indexed fields, what I need is your experience on these issues of solr or that someone can guide me, please!




Aucun commentaire:

Enregistrer un commentaire