Solr 6.6: How to define fields to store multiple slug variation for one posts?












0















We have tasks to find posts by various type of slugs:



posts/state
posts/city-name
posts/city-name/category
posts/city-name/category/subcategory
posts/long-title-slug
posts/category
posts/... what our seo expert want


We have all posts stored in mariadb and on change we push data to SOLR or delete from. While seo tasks grooving, we need to store all seo links in SOLR. We have unknown number of seo variations per posts.



We need to define fields to store multiple slug variation for one posts. How to?



UPDATE current SOLR Schema



  <field name="id" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
<field name="title" type="text" multiValued="false" indexed="true" stored="true"/>
<field name="facet_title" type="string" indexed="true" stored="true"/>
<field name="facet_title_length" type="int" indexed="true" stored="true" multiValued="false"/>
<field name="slug" type="string" indexed="true" stored="true"/>
<field name="description" type="text" indexed="true" stored="true"/>

<field name="company_name" type="string" indexed="true" stored="true"/>
<field name="logo" type="string" indexed="false" stored="true"/>
<field name="cpc" type="string" indexed="false" stored="true"/>
<field name="date" type="string" indexed="true" stored="true"/>

<field name="location" type="text" indexed="true" stored="true"/>
<field name="city" type="text" indexed="true" stored="true"/>
<field name="postalcode" type="text" indexed="true" stored="true"/>
<field name="address" type="text" indexed="true" stored="true"/>

<field name="industry" type="string" indexed="true" stored="true"/>

<field name="externalid" type="string" indexed="false" stored="true"/>
<field name="externalurl" type="string" indexed="false" stored="true"/>

<field name="premium" type="boolean" indexed="true" stored="true" default="false"/>
<field name="source" type="string" indexed="true" stored="true"/>

<field name="created" type="string" indexed="true" stored="true"/>
<field name="modified" type="string" indexed="true" stored="true"/>

<field name="hits" type="int" indexed="true" stored="true" multiValued="false"/>









share|improve this question

























  • What’s the problem here? Save all multiple slugs in a multivalue field?

    – Mysterion
    yesterday











  • @Mysterion yes, thats is problem, while i not have experience.

    – Salines
    yesterday













  • So, how you're doing indexing in solr right now?

    – Mysterion
    yesterday











  • We have php background task to push data to our external solr server (schema added to question)

    – Salines
    yesterday
















0















We have tasks to find posts by various type of slugs:



posts/state
posts/city-name
posts/city-name/category
posts/city-name/category/subcategory
posts/long-title-slug
posts/category
posts/... what our seo expert want


We have all posts stored in mariadb and on change we push data to SOLR or delete from. While seo tasks grooving, we need to store all seo links in SOLR. We have unknown number of seo variations per posts.



We need to define fields to store multiple slug variation for one posts. How to?



UPDATE current SOLR Schema



  <field name="id" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
<field name="title" type="text" multiValued="false" indexed="true" stored="true"/>
<field name="facet_title" type="string" indexed="true" stored="true"/>
<field name="facet_title_length" type="int" indexed="true" stored="true" multiValued="false"/>
<field name="slug" type="string" indexed="true" stored="true"/>
<field name="description" type="text" indexed="true" stored="true"/>

<field name="company_name" type="string" indexed="true" stored="true"/>
<field name="logo" type="string" indexed="false" stored="true"/>
<field name="cpc" type="string" indexed="false" stored="true"/>
<field name="date" type="string" indexed="true" stored="true"/>

<field name="location" type="text" indexed="true" stored="true"/>
<field name="city" type="text" indexed="true" stored="true"/>
<field name="postalcode" type="text" indexed="true" stored="true"/>
<field name="address" type="text" indexed="true" stored="true"/>

<field name="industry" type="string" indexed="true" stored="true"/>

<field name="externalid" type="string" indexed="false" stored="true"/>
<field name="externalurl" type="string" indexed="false" stored="true"/>

<field name="premium" type="boolean" indexed="true" stored="true" default="false"/>
<field name="source" type="string" indexed="true" stored="true"/>

<field name="created" type="string" indexed="true" stored="true"/>
<field name="modified" type="string" indexed="true" stored="true"/>

<field name="hits" type="int" indexed="true" stored="true" multiValued="false"/>









share|improve this question

























  • What’s the problem here? Save all multiple slugs in a multivalue field?

    – Mysterion
    yesterday











  • @Mysterion yes, thats is problem, while i not have experience.

    – Salines
    yesterday













  • So, how you're doing indexing in solr right now?

    – Mysterion
    yesterday











  • We have php background task to push data to our external solr server (schema added to question)

    – Salines
    yesterday














0












0








0








We have tasks to find posts by various type of slugs:



posts/state
posts/city-name
posts/city-name/category
posts/city-name/category/subcategory
posts/long-title-slug
posts/category
posts/... what our seo expert want


We have all posts stored in mariadb and on change we push data to SOLR or delete from. While seo tasks grooving, we need to store all seo links in SOLR. We have unknown number of seo variations per posts.



We need to define fields to store multiple slug variation for one posts. How to?



UPDATE current SOLR Schema



  <field name="id" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
<field name="title" type="text" multiValued="false" indexed="true" stored="true"/>
<field name="facet_title" type="string" indexed="true" stored="true"/>
<field name="facet_title_length" type="int" indexed="true" stored="true" multiValued="false"/>
<field name="slug" type="string" indexed="true" stored="true"/>
<field name="description" type="text" indexed="true" stored="true"/>

<field name="company_name" type="string" indexed="true" stored="true"/>
<field name="logo" type="string" indexed="false" stored="true"/>
<field name="cpc" type="string" indexed="false" stored="true"/>
<field name="date" type="string" indexed="true" stored="true"/>

<field name="location" type="text" indexed="true" stored="true"/>
<field name="city" type="text" indexed="true" stored="true"/>
<field name="postalcode" type="text" indexed="true" stored="true"/>
<field name="address" type="text" indexed="true" stored="true"/>

<field name="industry" type="string" indexed="true" stored="true"/>

<field name="externalid" type="string" indexed="false" stored="true"/>
<field name="externalurl" type="string" indexed="false" stored="true"/>

<field name="premium" type="boolean" indexed="true" stored="true" default="false"/>
<field name="source" type="string" indexed="true" stored="true"/>

<field name="created" type="string" indexed="true" stored="true"/>
<field name="modified" type="string" indexed="true" stored="true"/>

<field name="hits" type="int" indexed="true" stored="true" multiValued="false"/>









share|improve this question
















We have tasks to find posts by various type of slugs:



posts/state
posts/city-name
posts/city-name/category
posts/city-name/category/subcategory
posts/long-title-slug
posts/category
posts/... what our seo expert want


We have all posts stored in mariadb and on change we push data to SOLR or delete from. While seo tasks grooving, we need to store all seo links in SOLR. We have unknown number of seo variations per posts.



We need to define fields to store multiple slug variation for one posts. How to?



UPDATE current SOLR Schema



  <field name="id" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
<field name="title" type="text" multiValued="false" indexed="true" stored="true"/>
<field name="facet_title" type="string" indexed="true" stored="true"/>
<field name="facet_title_length" type="int" indexed="true" stored="true" multiValued="false"/>
<field name="slug" type="string" indexed="true" stored="true"/>
<field name="description" type="text" indexed="true" stored="true"/>

<field name="company_name" type="string" indexed="true" stored="true"/>
<field name="logo" type="string" indexed="false" stored="true"/>
<field name="cpc" type="string" indexed="false" stored="true"/>
<field name="date" type="string" indexed="true" stored="true"/>

<field name="location" type="text" indexed="true" stored="true"/>
<field name="city" type="text" indexed="true" stored="true"/>
<field name="postalcode" type="text" indexed="true" stored="true"/>
<field name="address" type="text" indexed="true" stored="true"/>

<field name="industry" type="string" indexed="true" stored="true"/>

<field name="externalid" type="string" indexed="false" stored="true"/>
<field name="externalurl" type="string" indexed="false" stored="true"/>

<field name="premium" type="boolean" indexed="true" stored="true" default="false"/>
<field name="source" type="string" indexed="true" stored="true"/>

<field name="created" type="string" indexed="true" stored="true"/>
<field name="modified" type="string" indexed="true" stored="true"/>

<field name="hits" type="int" indexed="true" stored="true" multiValued="false"/>






solr






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday







Salines

















asked yesterday









SalinesSalines

3,02831234




3,02831234













  • What’s the problem here? Save all multiple slugs in a multivalue field?

    – Mysterion
    yesterday











  • @Mysterion yes, thats is problem, while i not have experience.

    – Salines
    yesterday













  • So, how you're doing indexing in solr right now?

    – Mysterion
    yesterday











  • We have php background task to push data to our external solr server (schema added to question)

    – Salines
    yesterday



















  • What’s the problem here? Save all multiple slugs in a multivalue field?

    – Mysterion
    yesterday











  • @Mysterion yes, thats is problem, while i not have experience.

    – Salines
    yesterday













  • So, how you're doing indexing in solr right now?

    – Mysterion
    yesterday











  • We have php background task to push data to our external solr server (schema added to question)

    – Salines
    yesterday

















What’s the problem here? Save all multiple slugs in a multivalue field?

– Mysterion
yesterday





What’s the problem here? Save all multiple slugs in a multivalue field?

– Mysterion
yesterday













@Mysterion yes, thats is problem, while i not have experience.

– Salines
yesterday







@Mysterion yes, thats is problem, while i not have experience.

– Salines
yesterday















So, how you're doing indexing in solr right now?

– Mysterion
yesterday





So, how you're doing indexing in solr right now?

– Mysterion
yesterday













We have php background task to push data to our external solr server (schema added to question)

– Salines
yesterday





We have php background task to push data to our external solr server (schema added to question)

– Salines
yesterday












1 Answer
1






active

oldest

votes


















1














Make your slug field multiValued:



<field name="slug" type="string" indexed="true" stored="true" multiValued="true" />


.. and store all possible slug variations there. If you're only storing long-title-slug in that field today and would like to keep it that way, add a new field instead:



<field name="path_slug" type="string" indexed="true" stored="true" multiValued="true" />


.. and then include all possible values for the slugs there as an array.



['posts/state', 'posts/city-name', ....]


Exactly how you do that depends on the code you're using to submit content to Solr, but all Solr libraries support this in some way - either by making multiple calls to addField or similar, or giving an array to the addField method.



You can then query on that slug by using path_slug:posts/state.






share|improve this answer
























  • Wow, thanks for explanation

    – Salines
    yesterday











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54251826%2fsolr-6-6-how-to-define-fields-to-store-multiple-slug-variation-for-one-posts%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Make your slug field multiValued:



<field name="slug" type="string" indexed="true" stored="true" multiValued="true" />


.. and store all possible slug variations there. If you're only storing long-title-slug in that field today and would like to keep it that way, add a new field instead:



<field name="path_slug" type="string" indexed="true" stored="true" multiValued="true" />


.. and then include all possible values for the slugs there as an array.



['posts/state', 'posts/city-name', ....]


Exactly how you do that depends on the code you're using to submit content to Solr, but all Solr libraries support this in some way - either by making multiple calls to addField or similar, or giving an array to the addField method.



You can then query on that slug by using path_slug:posts/state.






share|improve this answer
























  • Wow, thanks for explanation

    – Salines
    yesterday
















1














Make your slug field multiValued:



<field name="slug" type="string" indexed="true" stored="true" multiValued="true" />


.. and store all possible slug variations there. If you're only storing long-title-slug in that field today and would like to keep it that way, add a new field instead:



<field name="path_slug" type="string" indexed="true" stored="true" multiValued="true" />


.. and then include all possible values for the slugs there as an array.



['posts/state', 'posts/city-name', ....]


Exactly how you do that depends on the code you're using to submit content to Solr, but all Solr libraries support this in some way - either by making multiple calls to addField or similar, or giving an array to the addField method.



You can then query on that slug by using path_slug:posts/state.






share|improve this answer
























  • Wow, thanks for explanation

    – Salines
    yesterday














1












1








1







Make your slug field multiValued:



<field name="slug" type="string" indexed="true" stored="true" multiValued="true" />


.. and store all possible slug variations there. If you're only storing long-title-slug in that field today and would like to keep it that way, add a new field instead:



<field name="path_slug" type="string" indexed="true" stored="true" multiValued="true" />


.. and then include all possible values for the slugs there as an array.



['posts/state', 'posts/city-name', ....]


Exactly how you do that depends on the code you're using to submit content to Solr, but all Solr libraries support this in some way - either by making multiple calls to addField or similar, or giving an array to the addField method.



You can then query on that slug by using path_slug:posts/state.






share|improve this answer













Make your slug field multiValued:



<field name="slug" type="string" indexed="true" stored="true" multiValued="true" />


.. and store all possible slug variations there. If you're only storing long-title-slug in that field today and would like to keep it that way, add a new field instead:



<field name="path_slug" type="string" indexed="true" stored="true" multiValued="true" />


.. and then include all possible values for the slugs there as an array.



['posts/state', 'posts/city-name', ....]


Exactly how you do that depends on the code you're using to submit content to Solr, but all Solr libraries support this in some way - either by making multiple calls to addField or similar, or giving an array to the addField method.



You can then query on that slug by using path_slug:posts/state.







share|improve this answer












share|improve this answer



share|improve this answer










answered yesterday









MatsLindhMatsLindh

25k22241




25k22241













  • Wow, thanks for explanation

    – Salines
    yesterday



















  • Wow, thanks for explanation

    – Salines
    yesterday

















Wow, thanks for explanation

– Salines
yesterday





Wow, thanks for explanation

– Salines
yesterday


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54251826%2fsolr-6-6-how-to-define-fields-to-store-multiple-slug-variation-for-one-posts%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Liquibase includeAll doesn't find base path

How to use setInterval in EJS file?

Petrus Granier-Deferre