Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLCommitter not storing data #14

Open
Rahul9354 opened this issue Jun 9, 2023 · 5 comments
Open

SQLCommitter not storing data #14

Rahul9354 opened this issue Jun 9, 2023 · 5 comments

Comments

@Rahul9354
Copy link

Rahul9354 commented Jun 9, 2023

I am trying to store data in mysql table using sqlcommitter but unable to do so cause I don't understand where to do the mapping for fields which will then get converted to mysql table columns. I am getting the required data in a json file when using a jsonfilecommitter. If you could please share an example of the config file and tags that I should be using it would be a great help.

@Rahul9354
Copy link
Author

hello @essiembre Can you help me out regarding my issue.

@ohtwadi
Copy link

ohtwadi commented Jun 13, 2023

You can use <fieldMappings> to map fields extracted by the Crawler to fields you would like to appear in your DB. This is well documented in our docs

For example, the snippet below will result in the crawler description field mapped to desc_mapped in your DB

<fieldMappings>
  <mapping
    fromField="description"
    toField="desc_mapped"/>
</fieldMappings>

@ohtwadi
Copy link

ohtwadi commented Jun 13, 2023

Additionally, if you only have one committer, you can rename the metadata fields via the Importer's RenameTagger

@Rahul9354
Copy link
Author

Rahul9354 commented Jun 16, 2023

@ohtwadi i have already renamed the meta tags with renameTagger I am getting issue in table creation and storage of data. Can the table be automatically created or do I have to use createTableSQL tag to manually create the table and how the renamed meta fields are mapped to the table. And what is the use of tags like restrictTo,fieldMatcher,valueMatcher,queue,
properties specifically I don't get. If you can share a sample xml configuration file it would be a great help.

@ohtwadi
Copy link

ohtwadi commented Jun 19, 2023

Can the table be automatically created or do I have to use createTableSQL tag to manually create the table

As per the docs:

By default, this Committer will throw an exception when trying to insert values into non-existing database table or fields. It is recommended you make sure your database table exists and the document fields being sent to the committer match your database fields.
Alternatively, you can provide the necessary SQLs to create a new table as well as new fields as needed using CreateTableSQL and CreateFieldSQL respectively

If you are having issues with table creation, you may create the table manually.

how the renamed meta fields are mapped to the table

Table column names will be the same as the field name in the Committer.

what is the use of tags like restrictTo,fieldMatcher,valueMatcher

See AbstractCommitter.

Queue

If you are just starting out, I suggest not tinkering with this just yet. It's very likely that the default options will work just fine for you. More details can be found here FSQueue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants