Add Custom fileds in index

  • ali.h@sela.ae
    Participant
    1 year, 10 months ago #29785

    Hello Support Team,

    How can we add custom fields to the document on indexing time. For example, the current document looks like:
    {
    “post_status_s”: “”,
    “displaymodified”: “2022-03-21T14:33:57Z”,
    “displaydate”: “2021-08-04T08:09:43Z”,
    “type”: “product”,
    “id”: 169900,
    “PID”: 169900,
    “title”: {
    “href”: “https:\/\/staging.sela.ae\/product\/al-ain-frozen-fine-okra-400-g\/”,
    “title”: “Al Ain – Frozen Fine Okra 400 g”
    },
    “image_src”: “https:\/\/staging.sela.ae\/wp-content\/uploads\/2021\/08\/5011636-150×150.jpg”,
    “content”: “…”,
    “meta_information”: {
    “author”: “By Del Monte”,
    “category”: “”,
    “date”: “, on 08\/04\/2021”,
    “comments_number”: “”
    }
    }
    ].

    but i want to have something like

    {
    “custom_field_1”: “test 1”,
    “custom_field_2”: “test 2”,
    “custom_field_3”: “test 3”,
    “post_status_s”: “”,
    “displaymodified”: “2022-03-21T14:33:57Z”,
    “displaydate”: “2021-08-04T08:09:43Z”,
    “type”: “product”,
    “id”: 169900,
    “PID”: 169900,
    “title”: {
    “href”: “https:\/\/staging.sela.ae\/product\/al-ain-frozen-fine-okra-400-g\/”,
    “title”: “Al Ain – Frozen Fine Okra 400 g”
    },
    “image_src”: “https:\/\/staging.sela.ae\/wp-content\/uploads\/2021\/08\/5011636-150×150.jpg”,
    “content”: “…”,
    “meta_information”: {
    “author”: “By Del Monte”,
    “category”: “”,
    “date”: “, on 08\/04\/2021”,
    “comments_number”: “”
    }
    }
    ];

    Regards

    wpsolr
    Keymaster
    1 year, 10 months ago #29786

    Select your custom fields on screen 2.2, in the “Product” section. They will be indexed automatically, and you can use them as facets on screen 2.4

    ali.h@sela.ae
    Participant
    1 year, 10 months ago #29793

    I want the field value in the document itself, not in facets or filters. exactly how we have the title and id etc..

    wpsolr
    Keymaster
    1 year, 10 months ago #29794

    Then you select them in screen 2.2, with the option “Index custom fields and categories”, then reindex all your products. You can then search them as the title and description.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.